返回列表 發帖
本帖最後由 劉漢文 於 2011-9-17 16:25 編輯
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {               
  5.    float x;
  6.    float y;
  7.    float z;
  8.    cout<<"梯形面積計算程式"<<endl;
  9.    cout<<"請輸入上底(cm)"<<endl;
  10.    cin>>x;
  11.    cout<<"請輸入下底(cm)"<<endl;
  12.    cin>>y;
  13.    cout<<"請輸入高(cm)"<<endl;
  14.    cin>>z;
  15.    cout<<"您輸入的上底是"<<x<<"您輸入的下底是"<<y<<"您輸入的高是"<<z<<endl;
  16.    cout<<"答案是..."<<endl;
  17.    cout<<"("<<x<<"+"<<y<<")"<<"*"<<z<<"/2="<<(x+y)*z/2<<平方公分endl;

  18.    system("pause");

  19.    return 0;

  20. }
複製代碼

TOP

返回列表