摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include <stdio.h> void mainMenu(); void login(); void returnToMain(); void regis 阅读全文
posted @ 2021-11-29 20:29 三庭远 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 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:26 三庭远 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1.字符串的长度. #include<stdio.h> main() { char str[80]; int i=0; int length=0; gets(str); puts(str); while(str[i++]!='\0') length++; printf("字符串的长度为:%d\n", 阅读全文
posted @ 2021-11-29 20:17 三庭远 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 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:14 三庭远 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1.定义一个含有8个储存单元的实行数组,从键盘上接收数,然后逆序输出。 include<stdio.h> main() { double m[8]; int i; for(i=0;i<=7;i++) scanf("%lf",&m[i]); for(i=7;i>=0;i--) printf("%f", 阅读全文
posted @ 2021-11-29 20:10 三庭远 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1.教材P52 例4-8 分数转成等级 switch #include <stdio.h> main() { int mark; printf("输入成绩\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n"); 阅读全文
posted @ 2021-10-31 20:24 三庭远 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 编写程序判断n是正数还是负数 #include <stdio.h> main(){ int n; scanf("%d",&n); if(n>0){ printf("正数"); } else if(n<0){ printf("负数"); } } 2.使用条件运算符,找出四个数a,b,c,d四个数中最大 阅读全文
posted @ 2021-10-31 20:20 三庭远 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 3.编写程序,判断一个数n是正数还是负数。 #include<stdio.h> main() { float n; scanf("%f",&n); if(n>0) printf("正数!\n"); else if(n==0) printf("0既不是正数,也不是负数!\n"); else print 阅读全文
posted @ 2021-10-24 12:00 三庭远 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 编写程序,定义两个整形变量,赋值并输出。 #include<stdio.h> main(){ int a=1; int b=2; printf("%d%d\n",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> main(){ floa 阅读全文
posted @ 2021-10-17 15:39 三庭远 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 1编写程序使用scanf()函数接受整型,实型,字符型的变量,并分行依次输出 #include<stdio.h> main() { int a; float b; char c; scanf("%d,%f,%c",&a,&b,&c); printf("%d\n%f\n%c\n",a,b,c); 2编 阅读全文
posted @ 2021-10-17 15:27 三庭远 阅读(6) 评论(0) 推荐(0) 编辑