返回列表 發帖
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    int x;
  6.    int y;
  7.    int z;
  8.    cout<<"歡迎進入炫宗的梯形面積計算程式"<<endl;
  9.    cout<<"請輸入上底"<<endl;
  10.    cin>>x;
  11.    cout<<"請輸入下底"<<endl;
  12.    cin>>y;
  13.    cout<<"請輸入高"<<endl;
  14.    cin>>z;
  15.    cout<<"您輸入的上底是"<<x<<endl;
  16.    cout<<"您輸入的下底是"<<y<<endl;
  17.    cout<<"您輸入的高是"<<z<<endl;
  18.    
  19.    
  20.    cout<<"答案是..."<<endl;
  21.    cout<<"("<<x<<"+"<<y<<")"<<"*"<<z<<"/2="<<(x+y)*z/2<<endl;


  22.    system("pause");
  23.    return 0;
  24. }
複製代碼

TOP

#include <iostream>
using namespace std;
int main()
{
   float x.y.z;
   
   cout<<"歡迎進入炫宗的梯形面積計算程式"<<endl;
   cout<<"請輸入上底"<<endl;
   cin>>x;
   cout<<"請輸入下底"<<endl;
   cin>>y;
   cout<<"請輸入高"<<endl;
   cin>>z;
   cout<<"您輸入的上底是"<<x<<endl;
   cout<<"您輸入的下底是"<<y<<endl;
   cout<<"您輸入的高是"<<z<<endl;
   
   
   cout<<"答案是..."<<endl;
   cout<<"("<<x<<"+"<<y<<")"<<"*"<<z<<"/2="<<(x+y)*z/2<<endl;


   system("pause");
   return 0;
}

TOP

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    float x,y,z;
  6.       cout<<"歡迎進入炫宗的梯形面積計算程式"<<endl;
  7.    cout<<"請輸入上底(cm)"<<endl;
  8.    cin>>x;

  9.    cout<<"請輸入下底(cm)"<<endl;
  10.    cin>>y;
  11.    cout<<"請輸入高(cm)"<<endl;
  12.    cin>>z;
  13.    cout<<"您輸入的上底是"<<x<<endl;
  14.    cout<<"您輸入的下底是"<<y<<endl;
  15.    cout<<"您輸入的高是"<<z<<endl;
  16.    
  17.    
  18.    cout<<"答案是..."<<endl;
  19.    cout<<"("<<x<<"+"<<y<<")"<<"*"<<z<<"/2="<<(x+y)*z/2<<endl;


  20.    system("pause");
  21.    return 0;
  22. }
複製代碼

TOP

返回列表