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

  3. using namespace std;

  4. int main ()
  5. {
  6. re:

  7. int h = 0;

  8. int w = 0;
  9. cout<<"請輸入矩形的高(公分):";
  10. cin>>h;       
  11. cout<<"請輸入矩形的寬(公分):";
  12. cin>>w;
  13. int l = (h + w)*2;
  14.         int m =h *w;



  15. cout<<"====================="<<endl;

  16. cout<<"這個矩形的周長是"<<l<<"公分"<<endl;

  17. cout<<"這個矩形的面積是"<<m<<"平方公分"<<endl;


  18.        
  19.        
  20.        
  21.         goto re;
  22.        
  23.         system ("pause");
  24.         return 0;

  25. }
複製代碼

TOP

返回列表