11 2021 档案

摘要:1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include<stdio.h> #include<string.h> void denglu(); void zhuce(); void shuixianhu 阅读全文
posted @ 2021-11-30 16:14 荽邊 阅读(21) 评论(0) 推荐(0)
摘要:1编写程序,使用循环结构,计算字符串长度。 #include<stdio.h> main(){ char a[50]; int i; gets(a); for(i=0;a[i]!='\0';i++); printf("%d",i); } 2编写程序,统计大写字母。 #include<stdio.h> 阅读全文
posted @ 2021-11-23 09:47 荽邊 阅读(25) 评论(0) 推荐(0)
摘要:1.定义一个含有8个存储单元的实型数组,从键盘上接收,然后逆序输出. #include<stdio.h> main(){ double a[8]; int i,j; for(i=0;i<=7;i++){ scanf("%lf",&a[i]); } for(j=7;j>=0;j--){ printf( 阅读全文
posted @ 2021-11-16 15:50 荽邊 阅读(42) 评论(0) 推荐(0)
摘要:1.编写程序,求s=1+(1+2)+(1+2+3)...(1+2+3....+n) #include<stdio.h> main(){ int a,b,n,i,j; scanf("%d",&n); a=0; b=0; for(i=1;i<=n;i++){ b+=i; a=a+b; } printf( 阅读全文
posted @ 2021-11-13 17:05 荽邊 阅读(33) 评论(0) 推荐(0)
摘要:#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(){ int i,j,v; for( 阅读全文
posted @ 2021-11-09 10:18 荽邊 阅读(19) 评论(0) 推荐(0)
摘要:1 使用while语句求和sum=1+3+5+7+...+21 #include<stdio.h> main(){ int sum,i; sum=0; i=1; while(i<=21){ sum+=i; i+=2; } printf("%d",sum); } 2 编写使用while语句求和sum= 阅读全文
posted @ 2021-11-04 15:25 荽邊 阅读(36) 评论(0) 推荐(0)
摘要:1.判断n是正数还是负数 #include<stdio.h> main(){ float n; printf("请输入一个数\n"); scanf("%f",&n); if(n<0){ printf("%f为负数",n); }else if(n>0){ printf("%f为正数",n); }els 阅读全文
posted @ 2021-11-04 15:11 荽邊 阅读(19) 评论(0) 推荐(0)