摘要: 1.编写程序,统计字符串中大写字母的个数 #include<stdio.h> main() { char str[20]; int i,cnt; cnt=i=0; gets(str); while(str[i]!='\0') { if(str[i]>='A'&&str[i]<='Z') cnt++; 阅读全文
posted @ 2021-11-29 20:41 崔花钱 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花 4.退出程序 请选择: #include<stdio.h> #include<string.h> void denglu(); void zhuce(); void shuixianhua(); main() 阅读全文
posted @ 2021-11-28 20:59 崔花钱 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 1.定义一个含有8个存储单元的实型数组,从键盘上接收数,然后逆序输出 #include<stdio.h> main() { int a[8],i; for(i=0;i<8;i++) { scanf("%d",&a[i]); } printf("逆序输出后\n"); for(i=7;i>=0;i--) 阅读全文
posted @ 2021-11-23 15:24 崔花钱 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 1. 猜数字随机产生一个0-99的数,猜猜看如果大了 就提示大一点如果小了 就提示小一点直到才对为止 #include<stdio.h> #include<stdlib.h> #include<time.h> int main(){ int a; srand((unsigned)time(NULL) 阅读全文
posted @ 2021-11-22 21:04 崔花钱 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1.输出以下图形 #include <stdio.h> main() { int a,b,n; for(a=1;a<=5;a++) { printf("\n"); for(b=1;b<=a;b++) { printf("*"); } } } 2.输出以下图形 #include <stdio.h> m 阅读全文
posted @ 2021-11-18 20:47 崔花钱 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1.p60 1 #include <stdio.h> main() { int a=1,b=0; while(a<=21) { if(a%2) b=b+a; a++; } printf("%d",b); } 2.p60 2 #include <stdio.h> main() { int i=1,n; 阅读全文
posted @ 2021-11-16 12:12 崔花钱 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1.p70页一题 #include <stdio.h> main() { int n; printf("请输入一个数字"); scanf("%d",&n); if(n>0) printf("这个数字是正数"); else if(n==0) printf("这个数字是0"); else printf( 阅读全文
posted @ 2021-11-02 10:57 崔花钱 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 1.教材P52 例4-8 #include <stdio.h> main() { int mark; printf("输入成绩\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n");break; case 8: 阅读全文
posted @ 2021-11-01 16:53 崔花钱 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,判断一个数n是正数还是负数。 #include <stdio.h> main() { int a; printf("请输入一个数"); scanf("%d",&a); if(a>0) printf("这是正数"); else printf("这是负数"); } 2.编写程序,计算出租车 阅读全文
posted @ 2021-10-27 20:51 崔花钱 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 1、编写程序,使用scanf()函数接受整型、实型、字符型的变量,并分行依次输出。 #include <stdio.h> main() { int a; float b; char c; scanf("%d%f%c",&a,&b,&c); printf("%d%f%c",a,b,c); } 2.编写 阅读全文
posted @ 2021-10-19 11:32 崔花钱 阅读(7) 评论(0) 推荐(0) 编辑