返回列表 發帖
本帖最後由 蔡沛倢 於 2022-12-2 20:15 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int y;
  7.     cout<<"請輸入矩形的底"<<y<<endl;
  8.     cin>>y;
  9.     int x;
  10.     cout<<"請輸入矩形的高"<<x<<endl;
  11.     cin>>x;
  12.     cout<<"矩形的高是"<<x<<"矩形的底是"<<y<<endl;
  13.     cout<<"矩形的面積是:"<<y*x<<"周長是:"<<(y+x)*2<<endl;
  14.     system("pause");
  15.     return 0;   
  16. }
複製代碼
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int y;
  7.     cout<<"請輸入三角形的底"<<y<<endl;
  8.     cin>>y;
  9.     int x;
  10.     cout<<"請輸入三角形的高"<<x<<endl;
  11.     cin>>x;
  12.     cout<<"三角形的高是"<<x<<"三角形的底是"<<y<<endl;
  13.     cout<<"三角形的面積是:  "<<y<<"*"<<x<<"/2"<<"="<<y*x/2<<endl;
  14.     system("pause");
  15.     return 0;   
  16. }
複製代碼

TOP

返回列表