第四次作业

#include<stdio.h>
int main(void)
{
int s,t,$;

scanf("%d%d",&s,&t);
if(s<=3)
if(t<5){
printf("$=10\n");
return 0;
}
else{
printf("$=%d",10+t/5*2);
return 0;
}
else
if(s>3&&s<10)
if(t<5)
{
printf("$=%d",10+(s-3)*2);
return 0;
}
else{
printf("$=%d",10+(s-3)*2+t/5*2);
return 0;
}
else
if(t<5){
printf("$=%d",10+(s-3)*2+(s-10)*3);
return 0;
}
else{
printf("$=%d",10+(s-3)*2+(s-10)*3+t/5*2);
return 0;
}
return 0;
}

 

 

#include <stdio.h>
#include <math.h>

int main()
{
double x1,y1,x2,y2,x3,y3,a,b,c,L,A;
printf("请输入三点坐标:");
scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
a=sqrt(pow((x1-x2),2)+pow((y1-y2),2) );
b=sqrt(pow((x1-x3),2)+pow((y1-y3),2) );
c=sqrt(pow((x3-x2),2)+pow((y3-y2),2) );
if((a+b)>c||(a+c)>b||(c+b)>a){
L=a+b+c;
A=sqrt(0.5*L*(0.5*L-a)*(0.5*L-c)*(0.5*L-b));
printf("周长 = %.2f, 面积= %.2f\n",L,A );
}
else{
printf("Impossible");
}


return 0;
}

 

 

 

通过几次的调试,终于调出来了,在调试过程中遇到很多问题,但也是我了解了很多。

 

posted @ 2019-04-10 19:37  朱生平  阅读(103)  评论(1编辑  收藏  举报