摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: #include<stdio.h> #include <string.h> void login(); void mainMenu(); void rigist(); void scs 阅读全文
posted @ 2021-11-29 23:45 出售星辰之书的书商 阅读(2) 评论(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 10:52 出售星辰之书的书商 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 定义一个含有8个存储单元的实型数组,从键盘上接收数,然后逆序输出 #include<stdio.h> int main(){ int a[8]; int i; for( i=0;i<=7;i++){ scanf("%d",&a[i]); } for(i=7;i>=0;i--){ printf("%d 阅读全文
posted @ 2021-11-17 23:59 出售星辰之书的书商 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 1.猜数字,随机产生1-99的数,如果大了,就提示大了;如果小了,就提示小了。直到猜对为止 #include<stdio.h> int main(void){ int a,N,c,n=0;//猜的是a scanf("%d %d",&a,&N);do//用户输入的是c scanf("%d",&c); 阅读全文
posted @ 2021-11-17 23:02 出售星辰之书的书商 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 1. * ** *** **** ***** #include<stdio.h>main(){ int i,j; for(i=1;i<=5;i++){ for(j=1;j<=9-i*2;j++) printf("*"); printf("\n"); } } ***** **** *** * #inc 阅读全文
posted @ 2021-11-17 22:42 出售星辰之书的书商 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1. 1编写程序,使用while语句求和sum=1+2+3+4+……..+21 #include<stdio.h> main(){ int i=1;int sum=0; while(i<=21){ sum+=i; i+=2; } printf("Sum=%d\n",sum); } 2.编写程序,使用 阅读全文
posted @ 2021-11-17 16:08 出售星辰之书的书商 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1.1编写程序判断n是正数还是负数 2.使用条件运算符,找出a,b,c,d四个数中最大的数 3.已知某商场进行促销活动,对于消费的价格有折扣活动,即消费1000元,打九折;消费2000元,打8.5折;消费3000元,打七折;消费5000元,打六折。编写程序代码求出消费者实际花费的价格 4.输入三条边 阅读全文
posted @ 2021-11-01 20:31 出售星辰之书的书商 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 1.用switch结构将分数转换成 等级 2.编写程序,根据x的值,求出 相应y的值。y={x*x+1(x>0); o(x=0); --x*x+1(x<0) 3. 使用多分支结构,实现两个加减乘除的简单计算器 4.输入年份判断是不是闰年 5.编写程序,使用条件运算符找出三个数中最小的数字,并输出 6 阅读全文
posted @ 2021-10-26 22:45 出售星辰之书的书商 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序 ,判断一个数n是正数还是负数 2.编写程序,计算出租车的行驶距离与费用之间的关系。起步3千米内,8元;之后1.6元每千米 3.输入一个数判断是奇数还是偶数 4.输入一个数,输出他的绝对值 5.输入两个数,输出较大数 阅读全文
posted @ 2021-10-21 20:17 出售星辰之书的书商 阅读(5) 评论(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-16 20:09 出售星辰之书的书商 阅读(20) 评论(0) 推荐(0) 编辑