- 450 名前:デフォルトの名無しさん mailto:sage [2009/07/02(木) 16:14:04 ]
- >>443
/* 課題1 */ #include <stdio.h> #include <math.h> int main() { struct Vertex { double x, y; } verA, verB, verC, verD; printf("verA (x, y): "); scanf("%lf %lf", &verA.x, &verA.y); printf("verB (x, y): "); scanf("%lf %lf", &verB.x, &verB.y); printf("verC (x, y): "); scanf("%lf %lf", &verC.x, &verC.y); printf("verD (x, y): "); scanf("%lf %lf", &verD.x, &verD.y); if (verA.y != verB.y || verC.y != verD.y) { printf("error\n"); } else { printf("area: %g\n", (fabs(verA.x-verB.x)+fabs(verC.x-verD.x))*fabs(verA.y-verC.y)/2); } return 0; }
|

|