摘要: #include#includeint max_approximate(int num1, int num2){ if (num1 > num2) { int tmp = 0; tmp = num1; num1 = num2; num2 = tmp; } int min = num1; ... 阅读全文
posted @ 2016-03-19 08:47 午饭要阳光 阅读(386) 评论(0) 推荐(0) 编辑
摘要: #include#includevoid add_state(float a, float b, float x, float y){ float m = a + x; float n = b + y; if (n > 0) printf("%f+%fi\n", m, n); else pr... 阅读全文
posted @ 2016-03-18 00:46 午饭要阳光 阅读(391) 评论(0) 推荐(0) 编辑
摘要: #define _CRT_SECURE_NO_WARNINGS 1#include#include#includevoid input(float **p, int x, int y){ for (int i = 0; i < x; i++) { for (int j = 0; j < y; ... 阅读全文
posted @ 2016-03-18 00:40 午饭要阳光 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 求一个数二进制中1的个数: 一般方法: #include #include int count_one_bits(unsignedint value) { int count = 0; for (int i = 0; i > 1; (右移一位相当于除2) } ... 阅读全文
posted @ 2016-03-17 23:51 午饭要阳光 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 常量和变量的样子完全一样,只是常量的值不允许被修改。我们用const这个关键字来声明一个常量。 例: const int a=10; int const a=10; 两种方式都可以声明一个常量效果是一样的。 我们也可以用const来修饰指针:... 阅读全文
posted @ 2016-03-16 21:30 午饭要阳光 阅读(131) 评论(0) 推荐(0) 编辑
摘要: #include #include #define _CRT_SECURE_NO_WARNINGS 1 int count_one_bits(unsigned int value) { int count = 0; while (value) { if ((value &1)==1) count... 阅读全文
posted @ 2016-03-16 21:10 午饭要阳光 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 常量和变量的样子完全一样,只是常量的值不允许被修改。我们用const这个关键字来声明一个常量。 例: const int a=10; int const a=10; 两种方式都可以声明一个常量效果是一样的。 我们也可以用const来修饰指针:... 阅读全文
posted @ 2016-03-16 20:23 午饭要阳光 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 一个后缀为“.c”文件(源文件),首先要被编译器编译生成目标文件(后缀为“.obj"),然后再通过链接转换为可执行文件(后缀为“.exe")才能运行。 编译:编译器对源文件进行编译,把源文件中以“文本形式”存在的源代码翻译成机器语言(二进制)的形式,并生成目标文件(源代码全部变成"二进制"的... 阅读全文
posted @ 2016-03-16 17:35 午饭要阳光 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1.给定两个整形变量的值,将两个值的内容进行交换。 2. 不允许创建临时变量,交换两个数的内容(附加题) 3. 求10 个整数中最大值。 4. 写一个函数返回参数二进制中 1 的个数 比如: 15 0000 1111 4 个 1 程序原型: int count_one_... 阅读全文
posted @ 2016-03-15 18:06 午饭要阳光 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 1. 打印100~200 之间的素数 2. 输出乘法口诀表 3. 判断1000年---2000年之间的闰年 #include #include #include int main() { int count = 0; int div = 0; printf("输出100—200之间的素数\n... 阅读全文
posted @ 2016-03-15 17:58 午饭要阳光 阅读(315) 评论(0) 推荐(0) 编辑