返回列表 發帖

三角形面積面積計算機

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     float x, y;
  6.     cout<<"<三角形面積面積計算機>"<<endl;
  7.     cout<<"請輸入三角形的底(公分): ";
  8.     cin>>x;
  9.     cout<<"請輸入三角形的高(公分): ";
  10.     cin>>y;
  11.     cout<<"底為"<<x<<"公分,高為"<<y<<"公分的三角形,面積為"<<
  12.           (x*y)/2<<"平方公分"<<endl;
  13.     system("pause");
  14.     return 0;   
  15. }
複製代碼

回復 1# tonyh
  1. #include<iostream>

  2. using namespace std;

  3. int main()

  4. {

  5.     float x, y;

  6.     cout<<"<三角形面積面積計算機>"<<endl;

  7.     cout<<"請輸入三角形的底(公分): ";

  8.     cin>>x;

  9.     cout<<"請輸入三角形的高(公分): ";

  10.     cin>>y;

  11.     cout<<"底為"<<x<<"公分,高為"<<y<<"公分的三角形,面積為"<<

  12.           (x*y)/2<<"平方公分"<<endl;

  13.     system("pause");

  14.     return 0;   

  15. }
複製代碼

TOP

  1. #include<iostream>

  2. using namespace std;

  3. int main()

  4. {

  5.     float x, y;

  6.     cout<<"<三角形面積面積計算機>"<<endl;

  7.     cout<<"請輸入三角形的底(公分): ";

  8.     cin>>x;

  9.     cout<<"請輸入三角形的高(公分): ";

  10.     cin>>y;

  11.     cout<<"底為"<<x<<"公分,高為"<<y<<"公分的三角形,面積為"<<

  12.           (x*y)/2<<"平方公分"<<endl;

  13.     system("pause");

  14.     return 0;   

  15. }
複製代碼

TOP

  1. #iclude<iostream> //input輸入 與output輸出
  2. using namespace std;
  3. int main()
  4. {
  5.     float a, b;
  6.       cout<<"<三角形面積面積計算機>"<<endl;
  7.     cout<<"請輸入三角形的底(公分): ";
  8.     cin>>x;
  9.     cout<<"請輸入三角形的高(公分): ";
  10.     cin>>y;
  11.     cout<<"底為"<<x<<"公分,高為"<<y<<"公分的三角形,面積為"<<
  12.           (x*y)/2<<"平方公分"<<endl;
  13.     system("pause");
  14.     return 0;   

  15. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     float x, y;
  6.     cout<<"<三角形面積面積計算機>"<<endl;
  7.     cout<<"請輸入三角形的底(公分): ";
  8.     cin>>x;
  9.     cout<<"請輸入三角形的高(公分): ";
  10.     cin>>y;
  11.     cout<<"底為"<<x<<"公分,高為"<<y<<"公分的三角形,面積為"<<
  12.           (x*y)/2<<"平方公分"<<endl;
  13.      system("pause");                     
  14.      return0;                                    
  15. }
複製代碼

TOP

返回列表