摘要: 1.实现一个菜单 #include<stdio.h> #include<string.h> void denglu(); void zhuce(); void shuixianhua(); main() { int a; printf("请选择\n1.登录\n2.注册\n3.输出水仙花数\n4.退出 阅读全文
posted @ 2021-11-29 21:40 薛莹莹 阅读(0) 评论(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] ); } for( 阅读全文
posted @ 2021-11-24 22:28 薛莹莹 阅读(1) 评论(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< 阅读全文
posted @ 2021-11-24 22:12 薛莹莹 阅读(4) 评论(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++; } printf("大 阅读全文
posted @ 2021-11-23 09:46 薛莹莹 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 输出如下形状 ******* ***** *** * * ** *** **** ***** #include <stdio.h> main() { int i,a; for (i=1;i<=5;i++) { for (a=1;a<=i;a++) printf("*"); printf("\n"); 阅读全文
posted @ 2021-11-09 13:31 薛莹莹 阅读(14) 评论(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-31 13:24 薛莹莹 阅读(22) 评论(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 13:35 薛莹莹 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 编写程序,判断一个数n是正数还是负数 #include <stdio.h> main(){ int n; printf("请输入一个数"); scanf("%d",&n); if(n<0){ printf("%d是一个负数",n); } else{ printf("%d是一个正数",n); } } 阅读全文
posted @ 2021-10-22 08:04 薛莹莹 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 编写程序,使用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-17 22:33 薛莹莹 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1,编写程序,定义两个整型变量,赋值并输出 #include<stdio.h> main(){ int a=3; int b=4; printf("%d %d\n",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出 #include<stdio.h> main(){ flo 阅读全文
posted @ 2021-10-15 14:12 薛莹莹 阅读(11) 评论(0) 推荐(0) 编辑