实验1

 task1——1
1
#include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 printf(" o \n"); 7 printf("<H>\n"); 8 printf("I I\n"); 9 printf("\n"); 10 printf(" o \n"); 11 printf("<H>\n"); 12 printf("I I\n"); 13 14 system("PAUSE"); 15 return 0; 16 }
 task1——2
1
#include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 printf(" o o \n"); 6 printf("<H> <H>\n"); 7 printf("I I I I\n"); 8 9 system("PAUSE"); 10 return 0; 11 }

task2——2
1
#include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 double x , ans; 7 8 while(scanf("%lf", &x) != EOF) 9 { 10 ans = pow(x , 365); 11 printf("%.2f的365次方: %.2f\n", x, ans); 12 printf("\n"); 13 } 14 15 16 system("PAUSE"); 17 return 0; 18 }

task2——3
1
#include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 double c, f; 7 8 while(scanf("%lf", &c) != EOF) 9 { 10 f = 1.8*c + 32; 11 printf("摄氏度为c = %.2f时, 华氏度f = %.2f\n", c, f); 12 printf("\n"); 13 14 15 } 16 system("PAUSE"); 17 return 0; 18 }

task3
1
#include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 double x, y; 7 char c1, c2, c3; 8 int a1, a2, a3; 9 10 scanf("%d%d%d", &a1, &a2, &a3); /* 第一处 */ 11 printf("%d,%d,%d\n", a1, a2, a3); 12 getchar(); 13 14 scanf("%c%c%c", &c1, &c2, &c3); 15 printf("%c,%c,%c\n",c1, c2, c3); 16 17 scanf("%lf,%lf",&x, &y); /* 第二处 */ 18 printf("%lf,%lf\n",x,y); 19 20 system("PAUSE"); 21 return 0; 22 }

task4
1
#include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 int age1, age2; 7 char gender1, gender2; 8 9 scanf("%d,%c,%d,%c", &age1, &gender1, &age2, &gender2); 10 printf("age1 = %d, gender1 = %c\n", age1, gender1); 11 printf("age2 = %d, gender2 = %c\n", age2, gender2); 12 13 system("PAUSE"); 14 return 0; 15 }

task5
1
#include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 char ans1, ans2; 7 8 printf("第3章认真学完一遍了没?(输入Y或y表示认真学完一遍了,输入N或n表示没有):"); 9 ans1 = getchar(); 10 getchar(); 11 12 printf("\n动手敲代码实践了没?(输入Y或y表示敲了,输入N或n表示木有敲):"); 13 ans2 = getchar(); 14 15 if((ans1 == 'y' || ans1 == 'Y') && (ans2 == 'y' || ans2 == 'Y')) 16 printf("\n罗马不是一天建成的,继续保持哦:)\n"); 17 else 18 printf("\n罗马不是一天毁灭的,我们回头建设吧\n"); 19 20 system("PAUSE"); 21 return 0;

task6
1
#include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 int answer; 7 char words[5000]; 8 printf("网课学习让一些人欢喜一些人忧.\n"); 9 printf("1.作为喜欢自学且自律的人,觉得这样很好,有网络,自主学习,很ok.\n"); 10 printf("2.不喜,不喜,很不喜,眼睛快瞎了,脑壳有点卡...\n"); 11 printf("3.中间派.不知道.说不清.\n"); 12 printf("你的选择;"); 13 scanf("%d, &answer"); 14 15 if(answer == 4 ) 16 { 17 printf("请补充说明你的想法:\n"); 18 getchar(); 19 gets(words); 20 } 21 22 printf("\n"); 23 24 printf("当遇到问题时,你会选择:\n"); 25 printf("1.遇到问题,就解决问题。不懂的,搜索式学习,逐个攻破.\n"); 26 printf("2.遇到问题,不高兴。然后,...,就没有了.\n"); 27 printf("你的选择:"); 28 scanf("%d, &anwer"); 29 30 if(answer == 1) 31 printf(":)\n"); 32 else if(answer == 2) 33 printf("这样不能解决问题啊...我们选择1好不好:)\n"); 34 else if(answer == 3) 35 { 36 printf("请补充说明你的想法:\n"); 37 getchar(); 38 gets(words); 39 } 40 41 system("PAUSE"); 42 return 0; 43 }

 

  1. 收获的知识点:

①    学会制作使程序运行一次就可以完成多次计算的循环;、

②    一些输入输出函数的使用方法,如putchar(),getchar()等;

③    对输入数据进行排序;

④    判断字符类型;

  1. 体会及尚存问题:

①    写程序真的很头秃;

②    还不够细心,会出现漏掉符号如“;”的问题;

③    还需要再多练练;

posted @ 2022-03-25 17:01  balamala  阅读(9)  评论(0编辑  收藏  举报