摘要: 1.猜数字,猜错提示,猜对结束。 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b,c; srand((unsigned)time(NULL)); a = rand(); printf("%d\ 阅读全文
posted @ 2021-11-25 22:51 浅殇之城 阅读(17) 评论(0) 推荐(0)
摘要: 1.用循环机构求字符串长度。 #include<stdio.h> main(){ char cs[20]; int i=0,lenght=0; gets(cs); puts(cs); while(cs[i++]!='\0') lenght++; printf("字符串的长度为:%d\n",lengh 阅读全文
posted @ 2021-11-25 22:49 浅殇之城 阅读(20) 评论(0) 推荐(0)
摘要: 1.定义一个含有8个储存单元的实型数组,从键盘上接收数,然后逆向输出。 #include<stdio.h> main(){ int i; double a[8]; printf("请输入8个实数\n"); for(i=0;i<=7;i++){ scanf("%lf",&a[i]); } for(i= 阅读全文
posted @ 2021-11-25 22:46 浅殇之城 阅读(15) 评论(0) 推荐(0)