【c++範例】求梯形面積

by - 晚上9:00

#include <iostream>
using namespace std;
int main()
{
    double top, bottom, height;
cout << "請輸入上底長度\n";
cin >> top;
    cout << "請輸入下底長度\n";
cin >> bottom;
    cout << "請輸入高度\n";
cin >> height;
cout << "面積是" << (top+bottom)*height/2 << endl;
return 0;
}


你可能會喜歡

0 意見