|
|
发表于 2019-9-1 02:40:12
|
显示全部楼层
本帖最后由 在东边 于 2019-9-1 02:43 编辑
测试题:
0. long long int
1. _Bool
2. sizeof 不是函数,是运算符
3. 一个字节等于 8 比特位
4. char 字符型
5. E、F
6. unsigned int
7.
动动手:
0.- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int res;
- res = pow(1, 2) + pow(2, 3) + pow(3, 4) + pow(4, 5) + pow(5, 6);
- printf("the result of 1^2 + 2^3 + 3^4 + 4^5 + 5^6 is %d\n", res);
-
- return 0;
- }
复制代码
1.- #include <stdio.h>
- #include <math.h>
- int main()
- {
- int i;
- unsigned long long sum = 0;
- unsigned long long temp;
- unsigned long long weight;
-
- for (i=0; i < 64; i++)
- {
- temp = pow(2, i);
- sum = sum + temp;
- }
-
- weight = sum / 25000;
-
- printf("舍罕王应该给予达依尔%llu粒麦子!\n", sum);
- printf("如果每25000粒麦子为1kg,那么应该给%llu公斤麦子!\n", weight);
-
- return 0;
- }
复制代码 |
|