摘要: 1.#include<stdio.h> main() { int a[8],i; for(i=0;i<8;i++) { scanf("%d",&a[i]); } printf("逆序输出后\n"); for(i=7;i>=0;i--) { printf("%d\n",a[i]); } } 2.使用一 阅读全文
posted @ 2021-12-09 13:12 冠希不在- 阅读(18) 评论(0) 推荐(0)
摘要: 1.实现一个菜单可以切换,可以返回主菜单 主菜单 (1).登录 (2).注册 (3).输入水仙花数 (4).退出程序 请选择: 选择后实现对应的功能 #include<stdio.h>#include<string.h>void mainMenu();void login();void return 阅读全文
posted @ 2021-12-09 13:09 冠希不在- 阅读(11) 评论(0) 推荐(0)
摘要: 1.实现一个菜单,可以切换,可以返回主菜单。(主菜单:1.登录 2.注册 3.输出水仙花数 4.退出程序。请选择: 选择后实现对应的功能) #include <stdio.h>#include <string.h>void mainMenu();void login();void regist(); 阅读全文
posted @ 2021-12-03 18:10 冠希不在- 阅读(24) 评论(0) 推荐(0)
摘要: 1. 猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b,c; srand((unsign 阅读全文
posted @ 2021-12-03 17:52 冠希不在- 阅读(37) 评论(0) 推荐(0)
摘要: 1、定义一个含有8个存储单元的实行数组,从键盘上接收数,然后逆序输出 #include <stdio.h> main() { int a[8],i,j; for( i=0;i<8;i++ ) { printf( "请输入第 %d数字",i+1 ); scanf( "%d",&a[i] ); } fo 阅读全文
posted @ 2021-12-03 17:48 冠希不在- 阅读(12) 评论(0) 推荐(0)
摘要: 编写程序,统计字符串中大写字母的个数。 #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++; 阅读全文
posted @ 2021-11-29 19:42 冠希不在- 阅读(24) 评论(0) 推荐(0)
摘要: 1.输出图形 #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() 阅读全文
posted @ 2021-11-26 21:42 冠希不在- 阅读(7) 评论(0) 推荐(0)
摘要: 1.编写程序,使用while语句求和sum=1+3+5+…+21 #include<stdio.h> main() { int i=1,sum=0; while(i<=21){ sum+=i; i+=2; } printf("Sum=%d\n",sum); } 2.编写程序,使用while语句求和s 阅读全文
posted @ 2021-11-24 21:05 冠希不在- 阅读(20) 评论(0) 推荐(0)
摘要: 1.书P52 例题4-8 #include<stdio.h> main() { int mark; printf("输入学生的分数(1-100):\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n");brea 阅读全文
posted @ 2021-10-31 13:24 冠希不在- 阅读(34) 评论(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 22:04 冠希不在- 阅读(35) 评论(0) 推荐(0)