Program1

实验1

实验1代码 p1:

#include<stdlib.h>

int main()
{
	printf(" o \n");
	printf("<H>\n");
	printf("I I\n");

	printf(" o \n");
	printf("<H>\n");
	printf("I I\n");

	system("pause");
	
	return 0;
}

实验1 p1截图
image

实验1代码 p2:

#include<stdlib.h>

int main()
{
	printf(" o     o \n");
	printf("<H>   <H>\n");
	printf("I I   I I\n");

	system("pause");
	
	return 0;
}

实验1 p2截图
image

实验2

实验二代码

#include<stdlib.h>
#include<math.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");

	system("pause");
	return 0;
}

实验二截图
image

实验3

实验3代码

#include<stdlib.h>

int main()
{
	char ans1,ans2;
	
	printf("每次课前认真预习,课后及时复习了没?(输入y或Y表示有,输入n或N表示没有):\n");
	ans1 = getchar();

	getchar();

	printf("动手敲代码实践了没?(输入y或Y表示敲了,输入n或N表示没敲):\n");
	ans2 = getchar();

	if((ans1 == 'y'||ans1 == 'Y') && (ans2 == 'y'||ans2 == 'Y'))
		printf("\n(罗马不是一天建成的,继续保持哦)\n");
	else
		printf("\n(罗马不是一天毁灭的,我们来建设吧)\n");

	system("pause");

	return 0;}

实验3截图
image

实验4

实验4代码

#include<stdlib.h>

int main()
{
	double x, y;
    char c1, c2, c3;
    int a1, a2, a3;
    
    scanf("%d%d%d", &a1, &a2, &a3);
    printf("a1 = %d, a2 = %d, a3 = %d\n", a1, a2, a3);
    
    scanf("%c%c%c", &c1, &c2, &c3);
    printf("c1 = %c, c2 = %c, c3 = %c\n", c1, c2, c3);
    
    scanf("%lf,%lf", &x, &y);
    printf("x = %f, y = %lf\n",x, y);

    system("pause");
    return 0;
}

实验4截图
image

实验5

实验5代码

#include<stdlib.h>

int main()
{
	int year;
	year =1e9/(365*24*60*60);
	printf("%d\n",year);

	system("pause");
	return 0;
}

实验5截图
image

实验6

实验6代码

#include<stdlib.h>
#include<math.h>

int main()
{
	double x,ans;

	while(scanf("%lf",&x)!=EOF)
	{
	ans = pow(x,365);
	printf("%.2f %.2f",x,ans);
	printf("\n");
	}

	system("pause");
	return 0;
}

实验6截图
image

实验7

实验7代码

#include<math.h>

int main()
{
	double F,C;

	while(scanf("%lf",&C)!=EOF)
	{
	F=9*C/5+32;
	printf("%.2f %.2f\n", C,F);
	printf("\n");
	}

	system("pause");
	return 0;
}

实验7截图
image

实验8

实验8代码

#include<stdlib.h>
#include<math.h>

int main()
{
	double s,a,b,c,area;

	while(scanf("%lf %lf %lf",&a,&b,&c)!=EOF)
	{
	s =(a+b+c)/2;
	area=sqrt(s*(s-a)*(s-b)*(s-c));
	printf("%.3f %.3f %.3f %.3f",a,b,c,area);
	printf("\n");
	}

	system("pause");
	return 0;
}

实验8截图
image

posted @ 2025-03-09 10:51  王皓惟  阅读(19)  评论(0)    收藏  举报