实验1

实验任务1 
#include <stdio.h>
int main()
{
	printf(" 0 \n");
    printf("<H>\n");
    printf("I I\n");
	system("PAUSE");
	return 0;
}

  实验结论task1.c

实验任务1(2)

 1 #include<stdio.h>
 2 int main()
 3 {
 4 printf(" 0      0\n");
 5 printf("<H     <H>\n");
 6 printf("I I    I I \n");
 7 
 8 
 9 return 0;
10     
11     
12 }
View Code

实验结论task1.2-c

 

 

 

 

实验任务2

#include <stdio.h>
int main ()
{
	double a,b,c;
scanf("%lf%lf%lf",&a,&b,&c);
if(a+b>c&&a+c>b&&b+c>a)
printf("能构成三角形\n");
else printf("不能构成三角形\n");
return 0;
}

  实验结论task2.c

实验任务3

 1 #include <stdio.h>
 2 int main()
 3 { 
 4 char ans1,ans2;
 5 printf("每次课前认真预习,课后认真复习了没?(输入y或者Y表示有,输入n或者N表示没有):");
 6 ans1=getchar();
 7 getchar();
 8 printf("\n动手敲代码实践了没?:");
 9 ans2=getchar();
10 if((ans1=='y'||ans1=='Y')&&(ans2=='y'||ans2=='Y'))
11 printf("\n罗马不是一天建成的,继续保持哦:)\n");
12 else
13 printf("\n罗马不是一天毁灭的,我们来建设吧\n");
14 return 0;
15 
16 }
View Code

实验结论task3.c

getchar(); 是为了防止第一个换行符影响下面字符的输入

如果去掉会使第二个直接读取\n

实验任务4

 1 #include<stdio.h>
 2 
 3 int main()
 4 {
 5     double x,y;
 6     char c1,c2,c3;
 7     int a1,a2,a3;
 8     
 9     scanf("%d%d%d",&a1,&a2,&a3);
10     printf("a1=%d,a2=%d,a3=%d\n",a1,a2,a3);
11     
12     scanf("%c%c%c",&c1,c2,c3);
13     printf("c1=%c,c2=%c,c3=%c\n",c1,c2,c3);
14     
15     scanf("%lf,%if",&x,&y);
16     printf("x=%f,y=%lf\n",x,y);
17     return 0;
18     
19     
20 }
View Code

实验结论

实验任务5

 1 #include<stdio.h>
 2 
 3 int main()
 4 {
 5 int year ;
 6 double totalSeconds=1e9;
 7 year=(int)(totalSeconds /(365*24*3600)+0.5);
 8 printf("10亿秒约等于%d年\n",year);
 9 return 0;
10     
11     
12 }
View Code

实验结论task5.c

实验任务6

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

实验结论task6.c-2

实验任务7

 1 #include<stdio.h>
 2 int main()
 3 {
 4 double C,F;
 5 while(scanf("%lf",&C)!=EOF)
 6 {
 7     F=(9.0/5)*C+32;
 8     printf("%.2foC=%.2foF\n",C,F);
 9 
10     printf("\n");
11 }
12 return 0;
13     
14     
15 }
View Code

实验结论task7.c

实验任务8

 1 #include<stdio.h>
 2 #include<math.h>
 3 
 4 int main()
 5 {
 6 double a,b,c,s,area;
 7 while(scanf("%lf %lf %lf",&a,&b,&c)!=EOF)
 8 {
 9     s=(a+b+c)/2;
10     area=sqrt(s*(s-a)*(s-b)*(s-c));
11     printf("a=%.0f,b=%.0f,c=%.0f,area=%.3f\n",a,b,c,area);
12 }
13 return 0;
14     
15     
16 }
View Code

实验结论task8.c

 

posted @ 2025-10-09 21:03  Aaaaa叉少  阅读(4)  评论(1)    收藏  举报