2018年9月20日

关于自动四舍五入

摘要: //printf("%.1f\n", 0.05);//自动四舍五入输出0.1 //printf("%.1f\n", 0.04);//自动四舍五入输出0.0 //printf("%.1f\n", -0.04);//自动四舍五入输出-0.0 阅读全文

posted @ 2018-09-20 14:13 lunatic6 阅读(228) 评论(0) 推荐(0)

字符串输入

摘要: 1. char a[100]; scanf("%s",a); 以字符串为单位处理时,直接使用数组名,无需& 输入字符串时,字符个数要小于数组的长度!!!!!!,7.59,例如输入5个字符,定义的字符数组至少应该有6个元素 输入字符串时,遇到回车或空格,输入结束,并且自动在串后面加上结束标志'\0' 阅读全文

posted @ 2018-09-20 12:34 lunatic6 阅读(219) 评论(0) 推荐(0)

2018年7月25日

对于多次输入数据的问题

摘要: 需要使用多次输入数据可以用这个结构while(scanf("%d", &a)){} 在循环中利用break跳出。 阅读全文

posted @ 2018-07-25 23:46 lunatic6 阅读(95) 评论(0) 推荐(0)

输出空格的小问题

摘要: #include <stdio.h> int main(){ int n,x=1; scanf("%d",&n); do { printf("%d ",x); x+=2; }while(x<=n-2); printf("%d",x); return 0;} 要求输出的数据间有空格,但是最后一个数据后 阅读全文

posted @ 2018-07-25 23:42 lunatic6 阅读(169) 评论(0) 推荐(0)

导航