摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: #include <stdio.h> #include <string.h> void menu(); void zhuce(); void denglu(); void shuixi 阅读全文
posted @ 2021-11-29 18:37 陌辰1 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1.定义一个含有8个储存单元的实型数组,从键盘上接收数字,然后逆向输出. #include <stdio.h> int main() { int a[8]; int i,j; for (i=0;i<8;i++) scanf("%d",&a[i]); for (j=7;j>=0;j--) printf 阅读全文
posted @ 2021-11-16 17:16 陌辰1 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1. 猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b,c; srand((unsign 阅读全文
posted @ 2021-11-13 00:21 陌辰1 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 输出如下形状 ******* ***** *** * * ** *** **** ***** #include <stdio.h> main() { int i,a; for (i=1;i<=5;i++) { for (a=1;a<=i;a++) printf("*"); printf("\n"); 阅读全文
posted @ 2021-11-09 10:17 陌辰1 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 编写程序,使用while语句求和sum=1+3+5+….+21. #include <stdio.h> main() { int a=1,sum=0; while(a<=21) { if(a%2!=0) { sum=sum+a; } a++; } printf("sum=%d\n",sum); } 阅读全文
posted @ 2021-11-02 17:29 陌辰1 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序判断n是正数还是负数。 #include <stdio.h> main() { float n; printf("输入一个数:"); scanf("%f",&n); if(n>0) printf("正数\n"); else if(n==0) printf("既不是正数也不是负数\n"); 阅读全文
posted @ 2021-10-29 17:28 陌辰1 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1.输入学生成绩,输出评级。 #include <stdio.h> main() { int mark; printf("请输入学生成绩:"); scanf("%d",&mark); switch (mark/10) { case 10: case 9:printf("A\n");break; ca 阅读全文
posted @ 2021-10-26 11:15 陌辰1 阅读(12) 评论(0) 推荐(1) 编辑
摘要: 编写程序,判断一个数n是正数还是负数 #include <stdio.h> main(){ int n; printf("请输入一个数"); scanf("%d",&n); if(n<0){ printf("%d是一个负数",n); } else{ printf("%d是一个正数",n); } } 阅读全文
posted @ 2021-10-20 21:22 陌辰1 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 编写程序,使用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-15 19:49 陌辰1 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 1,编写程序,定义两个整型变量,赋值并输出 #include <stdio.h> main() { int a=5; int b=4; printf("%d\n%d",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出 #include <stdio.h> main() { 阅读全文
posted @ 2021-10-12 12:13 陌辰1 阅读(6) 评论(0) 推荐(0) 编辑