摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include<stdio.h> #include<string.h> void a(); void b(); void c(); void d(); void 阅读全文
posted @ 2021-11-27 20:35 计算机2106尹金袁 阅读(13) 评论(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++; i 阅读全文
posted @ 2021-11-25 19:39 计算机2106尹金袁 阅读(9) 评论(0) 推荐(0) 编辑
摘要: P121 1题 #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",m[i]); } P121 2题 #include<st 阅读全文
posted @ 2021-11-16 12:17 计算机2106尹金袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> main(){ int x,guess; srand((unsigned int 阅读全文
posted @ 2021-11-12 20:12 计算机2106尹金袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 输出正三角 #include<stdio.h> main(){ int i,j; for(i=1;i<=6;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } } 输出倒三角 #include<stdio.h> main(){ int i, 阅读全文
posted @ 2021-11-09 10:08 计算机2106尹金袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 1,#include<stdio.h> main(){ int i=1;int sum=0; while(i<=21) {sum+=i; i+=2; } printf("sum=%d\n",sum); } 2, #include<stdio.h> main(){ int i=1;double sum 阅读全文
posted @ 2021-11-04 17:46 计算机2106尹金袁 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序判断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-11-01 19:51 计算机2106尹金袁 阅读(9) 评论(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-26 10:40 计算机2106尹金袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1,编写程序,判断一个数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-19 16:44 计算机2106尹金袁 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用scanf()接收整型·实型·字符型的变量,并分行依次输出。 #include <stdio.h> main() { int a=1; float b=2; char c='5'; printf("%d\n%f\n%c\n",a,b,c); } 2.编写程序,通过scanf()函数 阅读全文
posted @ 2021-10-18 21:53 计算机2106尹金袁 阅读(17) 评论(0) 推荐(0) 编辑