- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main ()
- {
- re:
- int h = 0;
- int w = 0;
- cout<<"請輸入矩形的高(公分):";
- cin>>h;
- cout<<"請輸入矩形的寬(公分):";
- cin>>w;
- int l = (h + w)*2;
- int m =h *w;
- cout<<"====================="<<endl;
- cout<<"這個矩形的周長是"<<l<<"公分"<<endl;
- cout<<"這個矩形的面積是"<<m<<"平方公分"<<endl;
-
-
-
- goto re;
-
- system ("pause");
- return 0;
- }
複製代碼 |