摘要:
#include<stdio.h> #include<string.h> void mainMenu(); void denglu(); void zhuce(); void shuixianhua(); void returnToMenu(); main(){ mainMenu(); } void 阅读全文
摘要:
1.用循环结构求字符串长度 #include<stdio.h> main() { char a[20]; int i=0,flag=0; gets(a); while(a[i]!='\0'){ flag++; i++; } printf("输入的字符串的长度是%d\n",flag); } 2.编写程 阅读全文
摘要:
1.定义一个含有8个储存单位的实型数组 #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\n",m[i]); } 2。使 阅读全文
摘要:
1.猜数字,随机产生一个0-99的数字,猜猜看如果大了,就提示大了点,小了就提示小了点,直到猜对为止。 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a, b ,c=0; srand((unsign 阅读全文
摘要:
1.定义一个含有8个储存单元的实型数组,从键盘上接收数,然后逆序输出。 #include <stdio.h> main(){ double a[8]; int i; for (i=0;i<7;i++) scanf("%lf",&a[i]); for(i=7;i>=0;i--) printf("%f" 阅读全文
摘要:
1. 输出以下图形 *************** #include<stdio.h> main() { int a, b; for(a = 1; a <= 5; a++){ for (b = 1; b <= a; b++ ) printf("*"); printf("\n"); } } 2.输入图 阅读全文
摘要:
1.编写程序,判断一个数n是正数还是负数。 #include <stdio.h> main() { int n; printf("请输入一个数:\n"); scanf_s("%d", &n); if (n > 0) printf("n为正数"); else if (n == 0) printf("n 阅读全文
摘要:
1.编写程序判断n是正数还是负数。 #include <stdio.h> main() { int n; printf("请输入一个数:\n"); scanf_s("%d", &n); if (n > 0) printf("n为正数"); else if (n == 0) printf("n既不是正 阅读全文
摘要:
教材P52 例4-8 分数转成等级 switch #include <stdio.h> main(){ int mark; printf("请输入学生的分数(0-100):\n"); scanf_s("%d",&mark); switch(mark/10) { case 10: //与case9:共 阅读全文
摘要:
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); 阅读全文