摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include <stdio.h> void mainMenu(); void login(); void returnToMain(); void regis 阅读全文
posted @ 2021-12-02 09:10 拾柒^ 阅读(6) 评论(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-12-02 09:01 拾柒^ 阅读(8) 评论(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-12-02 08:50 拾柒^ 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> #include<stdlib.h> #include<time.h> int main(){ int a,b,c; srand((unsigned)time(NULL)); a=rand(); b=a%100; while(b!=c) { printf("请 阅读全文
posted @ 2021-11-15 22:01 拾柒^ 阅读(13) 评论(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"); } } #include<stdio.h> main(){ int i,j,k; for(i 阅读全文
posted @ 2021-11-09 11:17 拾柒^ 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 1编写程序,使用while语句求和sum1+3+5+7+…+21 #include <stdio.h> main(){ int i=1,sum=0; while(i<=21){ if(i%2!=0){ sum+=i; } i++; } printf("和是%d\n",sum); } 2编写程序,使用 阅读全文
posted @ 2021-11-02 12:55 拾柒^ 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 编写程序判断n是正数还是负数。 #include<stdio.h> main() { int n; printf("请输入一个整数:\n"); scanf("%d",&n); if(n>0) printf("%d是正数!\n",n); else if(n==0) printf("%d既不是正数,也不 阅读全文
posted @ 2021-10-30 21:55 拾柒^ 阅读(36) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>main(){ int mark; printf("输入分数:\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n");break; case 8:printf("B\n");b 阅读全文
posted @ 2021-10-29 13:35 拾柒^ 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 1编写程序,判断一个数是正数还是负数 #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-19 10:40 拾柒^ 阅读(11) 评论(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); } 阅读全文
posted @ 2021-10-17 21:30 拾柒^ 阅读(35) 评论(0) 推荐(0) 编辑