返回列表 發帖
  1. #include <iostream>

  2. using namespace std;

  3. int main()

  4. {

  5.     int x;
  6.     int y;
  7.     int z;
  8.     cout<<"請輸入上底"<<endl;

  9.     cin>>x;

  10.     cout<<"請輸入下底"<<endl;
  11.    
  12.     cin>>y;
  13.    
  14.     cout<<"請輸入高"<<endl;
  15.    
  16.     cin>>z;
  17.    
  18.     cout<<"梯形面積為"<<x+y*z/2<<"平方"<<endl;
  19.      
  20. system("pause");

  21.   return 0;   

  22. }
複製代碼

TOP

  1. #include <iostream>



  2. using namespace std;



  3. int main()



  4. {



  5.     float x,y,z;

  6.     cout<<"請輸入上底(cm)"<<endl;



  7.     cin>>x;



  8.     cout<<"請輸入下底(cm)"<<endl;

  9.    

  10.     cin>>y;

  11.    

  12.     cout<<"請輸入高(cm)"<<endl;

  13.    

  14.     cin>>z;

  15.    

  16.     cout<<"梯形面積為"<<(x+y)*z/2<<"平方cm"<<endl;

  17.      

  18.     system("pause");



  19.     return 0;   



  20. }
複製代碼

TOP

返回列表