返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.         int h = 0;
  7.         int w = 0;
  8.         cout<<"請輸入矩形的高(公分):";
  9.         cin>>h;
  10.         cout<<"請輸入矩形的寬(公分):";
  11.         cin>>w;
  12.         int l = (h+w)*2;
  13.         int m = h*w;
  14.         cout<<"====================="<<endl;
  15.         cout<<"這個矩形的周長是"<<l<<"公分"<<endl;
  16.         cout<<"這個矩形面積的是"<<m<<"平方公分"<<endl;
  17.        
  18.         system("pause");
  19.         return 0;
  20. }
複製代碼

TOP

返回列表