上一页 1 ··· 279 280 281 282 283 284 285 286 287 ··· 367 下一页
摘要: c语言中输出十进制数转换为二进制数后包含1的数目 1、 #include <stdio.h> int main(void) { unsigned a; puts("please input a nonnegative integers."); printf("a = "); scanf("%u", 阅读全文
posted @ 2021-05-20 22:54 小鲨鱼2018 阅读(196) 评论(0) 推荐(0) 编辑
摘要: c语言中sizeof运算符,输出不同数据类型的长度 1、 a、sizeof运算符的符号是字节 b、各种数据类型的有符号型和无符号型长度一致 c、一般情况 short <= int <= long。 #include <stdio.h> int main(void) { puts("show the 阅读全文
posted @ 2021-05-20 21:18 小鲨鱼2018 阅读(587) 评论(0) 推荐(0) 编辑
摘要: c语言中的位以及不同的数据类型可以表示的数值的范围。 1、计算机中的所有数据类型都是用0和1的组合来表示的,这个0和1的占位就是位。 位是具有大量内存空间的运行环境的数据存储单元,可保存具有两种取值的对象。 不同数据类型在内存上的占位决定了其可以表示数值的范围。 比如无符号整型在内存上的占位为n,那 阅读全文
posted @ 2021-05-20 21:07 小鲨鱼2018 阅读(587) 评论(0) 推荐(0) 编辑
摘要: c语言中在编译器中判断char属于signed char 还是 unsigned char。 1、 判断CHAR_MIN非0,则输出“signed”, 如果为0,则输出“unsigned”,因为unsigned型的最小值为0. #include <stdio.h> #include <limits. 阅读全文
posted @ 2021-05-20 20:57 小鲨鱼2018 阅读(205) 评论(0) 推荐(0) 编辑
摘要: c语言中输出整型和字符型9中数据类型在编译器中可以表示的数值范围。 1、 a、无符号整型的显示使用 %u b、long型数据的显示使用 %l c、无符号整型的最小值为0. #include <stdio.h> #include <limits.h> int main(void) { printf(" 阅读全文
posted @ 2021-05-20 20:50 小鲨鱼2018 阅读(476) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { float x1, sum1 = 0.0; for(x1 = 0.0; x1 <= 1.0; x1 += 0.01) { sum1 += x1; } int i; float sum2 = 0.0; for(i = 1; 阅读全文
posted @ 2021-05-20 19:04 小鲨鱼2018 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 1、 利用浮点进行循环的时候,计算机不能保证计算机内部转换为二进制后不发生数据丢失,因此随着循环的进行,会发生误差的积累。 #include <stdio.h> int main(void) { int i; float x1 = - 0.01, x2; for(i = 0; i <= 100; i 阅读全文
posted @ 2021-05-20 18:37 小鲨鱼2018 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> #include <math.h> int main(void) { double x; puts("please input an double value."); printf("x = "); scanf("%lf", &x); printf("re 阅读全文
posted @ 2021-05-20 18:07 小鲨鱼2018 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { float x1, sum1 = 0.0; for(x1 = 0.0; x1 <= 1.0; x1 += 0.01) { sum1 += x1; } int i; float x2, sum2 = 0.0; for(i = 阅读全文
posted @ 2021-05-20 15:54 小鲨鱼2018 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { float x1 = -0.01; int x2 = 0; int i; float sum1 = 0.0 , sum2 = 0.0; for(i = 0; i <= 100; i++) { x1 += 0.01; sum 阅读全文
posted @ 2021-05-20 13:03 小鲨鱼2018 阅读(51) 评论(0) 推荐(0) 编辑
上一页 1 ··· 279 280 281 282 283 284 285 286 287 ··· 367 下一页