Предмет: Информатика, автор: lybkivskyiyra

100 балов. Помогите...

Приложения:

Ответы

Автор ответа: nazikmuz
1

Відповідь:

C code:

#include <stdio.h>

#include <math.h>

float len(int x1,int y1,int x2,int y2){

float result = sqrt(pow(x2 - x1,2) + pow(y2 - y1,2));

return result;

}

float p(int a,int b,int c){

return (a + b + c)/2;

}

float S(int a,int b,int c){

int per = p(a,b,c);

return sqrt(per * (per - a) * (per - b) * (per - c));

}

int main(){

int x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6;

printf("\tA1\n");

printf("x1: ");

scanf("%d",&x1);

printf("y1: ");

scanf("%d",&y1);

printf("\tB1\n");

printf("x2: ");

scanf("%d",&x2);

printf("y2: ");

scanf("%d",&y2);

printf("\tC1\n");

printf("x3: ");

scanf("%d",&x3);

printf("y3: ");

scanf("%d",&y3);

printf("\tA2\n");

printf("x4: ");

scanf("%d",&x4);

printf("y4: ");

scanf("%d",&y4);

printf("\tB2\n");

printf("x5: ");

scanf("%d",&x5);

printf("y5: ");

scanf("%d",&y5);

printf("\tC2\n");

printf("x6: ");

scanf("%d",&x6);

printf("y6: ");

scanf("%d",&y6);  

float a1 = len(x1,y1,x2,y2);

float b1 = len(x2,y2,x3,y3);

float c1 = len(x3,y3,x1,y1);

float a2 = len(x4,y4,x5,y5);

float b2 = len(x5,y5,x6,y6);

float c2 = len(x6,y6,x4,y4);

float S1 = S(a1,b1,c1);

float S2 = S(a2,b2,c2);

if(S1 > S2){

 printf("S1");

}

else if(S1 < S2){

 printf("S2");

}

else{

 printf("equals");

}

return 0;

}

Похожие вопросы
Предмет: Английский язык, автор: Mahabbbbbbbbbbbbat
Предмет: Английский язык, автор: sorokinaany