C/C++の宿題を片付けます 119代目
■ このスレッドは過去ログ倉庫に格納されています
0407デフォルトの名無しさん
2008/12/09(火) 17:19:04#include <stdio.h>
double area(double w, double h)
{ return w * h; }
int main(void) {
double width1, height1, width2, height2;
double s1, s2;
printf("四つの実数値を入力: ");
scanf("%lf %lf %lf %lf", &width1, &height1, &width2, &height2);
s1 = area(width1, height1);
s2 = area(width2, height2);
printf("一つ目の長方形の面積: %lg\n", s1);
printf("二つ目の長方形の面積: %lg\n", s2);
if (s2 < s1) printf("一つ目の長方形の方が大きい\n");
else if (s1 < s2) printf("二つ目の長方形の方が大きい\n");
else printf("同じ大きさ\n");
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています