摘要: #include<stdio.h> #include<string.h> void a(); void b(); void c(); void d(); void e(); main(){ a(); } void a(){ int i; printf("主菜单\n1.登录\n2.注册\n3.输入水仙 阅读全文
posted @ 2021-12-08 20:05 暖存啊 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 1、编写程序,统计字符串中大写字母的个数 #include <stdio.h> main() { char str[80]; int i=0; int cnt=0; printf("请输入你的字母:"); gets(str); while ( str[i]!=0 ) { if ( str[i]>=' 阅读全文
posted @ 2021-12-08 20:04 暖存啊 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> #include <stdlib.h> #include <time.h>main(){ int x,guess; srand((unsigned int)time(NULL)); guess=rand()%100; while(1){ printf("请输入数 阅读全文
posted @ 2021-12-08 20:03 暖存啊 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #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( 阅读全文
posted @ 2021-11-09 10:12 暖存啊 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用while语句求和sum=1+3+5+7+…+21。 #include <stdio.h> main() { int a=1,sum=0; while(a<=21) { if(a%2==1) { sum+=a; } a++; } printf("%d",sum); } 2.编写程序 阅读全文
posted @ 2021-11-02 18:53 暖存啊 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序判断n是正数还是负数。 #include <stdio.h> main() { float n; printf("输入一个数:\n"); scanf("%f",&n); if(n>0) printf("正数\n"); else if(n==0) printf("既不是正数也不是负数\n" 阅读全文
posted @ 2021-10-29 17:42 暖存啊 阅读(24) 评论(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-29 17:32 暖存啊 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,判断一个数n是正数还是负数。 #include<stdio.h> main() { float n; scanf("%f",&n); if(n>0) printf("正数"); else printf("负数"); } 2.编写程序,计算出租车的行驶距离与费用之间的关系。起步3km内, 阅读全文
posted @ 2021-10-20 22:50 暖存啊 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用scan()函数接收整型、实型、字符型的变量,并分行进行输出。 #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-16 00:27 暖存啊 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1,编写程序,定义两个整型变量,赋值并输出 #include<stdio.h> main(){ int a=3; int b=4; printf("%d %d\n",a,b); 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出 #include<stdio.h> main(){ float 阅读全文
posted @ 2021-10-12 20:55 暖存啊 阅读(21) 评论(0) 推荐(0) 编辑