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

  3. using namespace std;

  4. int main()
  5. {
  6.         int w = 0;
  7.         int h = 0;
  8.         cout << "請輸入矩形的高(公分):";
  9.         cin >> h;
  10.         cout << "請輸入矩形的寬(公分):";
  11.         cin >> w;
  12.        
  13.         int l =( w + h ) * 2;
  14.         int m = w * h;
  15.        
  16.         cout << "=====================" << endl;
  17.         cout << "這個矩形的周長是" << l << "公分" << endl;
  18.         cout << "這個矩形的面積是" << m << "平方公分" << endl;
  19.        
  20.         system("pause");
  21.         return 0;
  22. }
複製代碼

TOP

返回列表