摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序请选择: 选择后实现对应的功能 #include<stdio.h> #include<string.h> void a(); void b(); void c(); void d(); void e 阅读全文
posted @ 2021-11-27 22:43 与花 阅读(18) 评论(0) 推荐(0)
摘要: 1、编写程序,统计字符串中大写字母的个数 #include <stdio.h> main() { char str[80]; int i=0; int cnt=0; printf("请输入你的字母:"); gets(str); while ( str[i]!=0 ) { if ( str[i]>=' 阅读全文
posted @ 2021-11-27 22:29 与花 阅读(17) 评论(0) 推荐(0)
摘要: 1、定义一个含有8个存储单元的实行数组,从键盘上接收数,然后逆序输出 #include <stdio.h> main() { int a[8],i,j; for( i=0;i<8;i++ ) { printf( "请输入第 %d数字",i+1 ); scanf( "%d",&a[i] ); } fo 阅读全文
posted @ 2021-11-27 22:23 与花 阅读(21) 评论(0) 推荐(0)
摘要: 1. 猜数字:随机产生一个0-99的数,猜猜看如果大了就提示大了点如果小了就提示小了点直到猜对为止 #include <stdio.h> int main() { int a,n; srand((unsigned)time(NULL)); a=rand()%100+1; printf("请输入你心里 阅读全文
posted @ 2021-11-27 22:04 与花 阅读(29) 评论(0) 推荐(0)
摘要: #include<stdio.h> main(){ int i,j; for(i=1;i<=5;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } } #include<stdio.h> main(){ int i,j,k; for(i=1 阅读全文
posted @ 2021-11-09 19:03 与花 阅读(35) 评论(0) 推荐(0)
摘要: 编写程序,使用while语句求和sum=1+3+5+…21 #include<stdio.h> main(){ int i=1; int sum=0; while(i<=21) { sum+=i; i+=2; } printf("sum=%d\n",sum); } #include<stdio.h> 阅读全文
posted @ 2021-11-02 20:09 与花 阅读(41) 评论(0) 推荐(0)
摘要: 1.编写程序判断n是整数还是负数 #include <stdio.h> main() { int n; printf("输入一个整数:\n"); scanf("%d",&n); if(n>0) printf("%d是正数!\n"); else if(n==0) printf("%d既不是正数,也不是 阅读全文
posted @ 2021-11-01 22:20 与花 阅读(57) 评论(0) 推荐(0)
摘要: 教材52页4-8. #include <stdio.h> main() { int mark; printf("输入学生的分数(0-100):\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n");break; 阅读全文
posted @ 2021-10-29 12:54 与花 阅读(35) 评论(0) 推荐(0)
摘要: 编写程序,判断一个数n是正数还是负数。 #include <stdio.h> main() { float n; scanf("%f",&n); if(n>0) printf("正数\n"); else if(n==0) printf("0既不是正数,也不是负数\n"); else printf(" 阅读全文
posted @ 2021-10-24 21:41 与花 阅读(21) 评论(0) 推荐(0)
摘要: 1、编写程序,定义两个整形变量,赋值并输出。 #include<stdio.h> main() { int a=1,b=2; printf("%d\n%d\n",a,b); } 2、编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> main() { flo 阅读全文
posted @ 2021-10-12 10:30 与花 阅读(88) 评论(0) 推荐(0)