11 2021 档案

摘要:1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include<stdio.h> #include <string.h> void login(); void mainMenu(); void rigist( 阅读全文
posted @ 2021-11-26 19:57 浅殇之城 阅读(27) 评论(0) 推荐(0)
摘要:1.猜数字,猜错提示,猜对结束。 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b,c; srand((unsigned)time(NULL)); a = rand(); printf("%d\ 阅读全文
posted @ 2021-11-25 22:51 浅殇之城 阅读(24) 评论(0) 推荐(0)
摘要:1.用循环机构求字符串长度。 #include<stdio.h> main(){ char cs[20]; int i=0,lenght=0; gets(cs); puts(cs); while(cs[i++]!='\0') lenght++; printf("字符串的长度为:%d\n",lengh 阅读全文
posted @ 2021-11-25 22:49 浅殇之城 阅读(28) 评论(0) 推荐(0)
摘要:1.定义一个含有8个储存单元的实型数组,从键盘上接收数,然后逆向输出。 #include<stdio.h> main(){ int i; double a[8]; printf("请输入8个实数\n"); for(i=0;i<=7;i++){ scanf("%lf",&a[i]); } for(i= 阅读全文
posted @ 2021-11-25 22:46 浅殇之城 阅读(17) 评论(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() { in 阅读全文
posted @ 2021-11-14 14:37 浅殇之城 阅读(25) 评论(0) 推荐(0)
摘要:1.编写程序,使用while语句求和sum=1+3+5+…+21。 #include<stdio.h> main(){ int i=1,sum=0; while(i<=21){ sum=sum+i; i+=2; } printf("sum=%d\n",sum); } 2.编写程序,使用while语句 阅读全文
posted @ 2021-11-02 10:16 浅殇之城 阅读(31) 评论(0) 推荐(0)