摘要: 1.编写程序,统计字符串中大写字母的个数 #include<stdio.h> main() { char str[5]; int i,cnt; cnt=i=0; gets(str); while(str[i]!='\0') {if(str[i]>='A'&&str[i]<='Z') cnt++; i 阅读全文
posted @ 2021-11-23 09:59 王师蕴 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1.定义一个含有8个存储单元的实型数组,从键盘上接收数,然后逆序输出 #include<stdio.h> main(){ double a[8]; int i; for(i=0;i<=7;i++); scanf("%lf",&a[i]); for(i=7;i>=0;i--); printf("%f" 阅读全文
posted @ 2021-11-23 09:22 王师蕴 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1. 猜数字:随机产生一个0-99的数,猜猜看如果大了就提示大了点如果小了就提示小了点直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,n; srand((unsigned)time( 阅读全文
posted @ 2021-11-23 09:19 王师蕴 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1.输出图形 #include <stdio.h> main() { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("*"); } printf("\n"); } } 2..输出图形 #include <stdio.h> main() 阅读全文
posted @ 2021-11-23 09:18 王师蕴 阅读(3) 评论(0) 推荐(0) 编辑