返回列表 發帖

面積計算 (一) - 矩形

本帖最後由 tonyh 於 2014-8-23 12:01 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cout<<"請輸入矩形的長(公分): ";
  8.     cin>>x;
  9.     cout<<"請輸入矩形的寬(公分): ";
  10.     cin>>y;
  11.     cout<<"長"<<x<<"公分,寬"<<y<<"公分的矩形,周長為"<<(x+y)*2
  12.         <<",面積為"<<x*y<<"平方公分."<<endl;
  13.     system("pause");
  14.     return 0;   
  15. }
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x;
  7.     int y;
  8.     cout<<"請輸入寬"<<endl;
  9.     cin>>x;
  10.     cout<<"請輸入長"<<endl;
  11.     cin>>y;
  12.     cout<<"周長為: "<<2*(x+y)<<endl;
  13.     cout<<"面積為: "<<x*y<<endl;  
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼
http://fs-old.mis.kuas.edu.tw/~s1102137106/music/

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cout<<"請輸入矩形的長(cm):";
  8.     cin>>x;
  9.     cout<<"請輸入矩形的寬(cm):";
  10.     cin>>y;
  11.     cout<<"長"<<x<<"cm,寬"<<y<<"公分的矩形,周長為"<<(x+y)*2<<",面積為"<<x*y<<"平方公分"<<endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cout<<"請輸入矩形的長(公分): ";
  8.     cin>>x;
  9.     cout<<"請輸入矩形的寬(公分): ";
  10.     cin>>y;
  11.     cout<<"長"<<x<<"公分,寬"<<y<<"公分的矩形,周長為"<<(x+y)*2
  12.         <<",面積為"<<x*y<<"平方公分."<<endl;
  13.     system("pause");
  14.      system("pause");
  15.     cout<<"\a"<<"\n";
  16.     system("pause");
  17.     cout<<"\a"<<"\n";
  18.     system("pause");
  19.     cout<<"\a"<<"\n";
  20.     system("pause");
  21.     cout<<"\a"<<"\n";
  22.     system("pause");
  23.     cout<<"\a"<<"\n";
  24.     system("pause");
  25.     cout<<"\a"<<"\n";
  26.     system("pause");
  27.     cout<<"\a"<<"\n";
  28.     system("pause");
  29.     cout<<"\a"<<"\n";
  30.     system("pause");
  31.     cout<<"\a"<<"\n";
  32.     system("pause");
  33.     cout<<"\a"<<"\n";
  34.     system("pause");
  35.     cout<<"\a"<<"\n";
  36.     system("pause");
  37.     cout<<"\a"<<"\n";
  38.     system("pause");
  39.     cout<<"\a"<<"\n";
  40.     system("pause");
  41.     cout<<"\a"<<"\n";
  42.     system("pause");
  43.     cout<<"\a"<<"\n";
  44.     system("pause");
  45.     cout<<"\a"<<"\n";
  46.     system("pause");
  47.     cout<<"\a"<<"\n";
  48.     system("pause");
  49.     cout<<"\a"<<"\n";
  50.     system("pause");
  51.     cout<<"\a"<<"\n";
  52.     system("pause");
  53.     cout<<"\a"<<"\n";
  54.      system("pause");
  55.     cout<<"\a"<<"\n";
  56.     system("pause");
  57.     cout<<"\a"<<"\n";
  58.     system("pause");
  59.     cout<<"\a"<<"\n";
  60.     system("pause");
  61.     cout<<"\a"<<"\n";
  62.     system("pause");
  63.     cout<<"\a"<<"\n";
  64.     system("pause");
  65.     cout<<"\a"<<"\n";
  66.     system("pause");
  67.     cout<<"\a"<<"\n";
  68.     system("pause");
  69.     cout<<"\a"<<"\n";
  70.     system("pause");
  71.     cout<<"\a"<<"\n";
  72.     system("pause");
  73.     cout<<"\a"<<"\n";
  74.     system("pause");
  75.     cout<<"\a"<<"\n";
  76.     system("pause");
  77.     cout<<"\a"<<"\n";
  78.     system("pause");
  79.     cout<<"\a"<<"\n";
  80.     system("pause");
  81.     cout<<"\a"<<"\n";
  82.     system("pause");
  83.     cout<<"\a"<<"\n";
  84.     system("pause");
  85.     cout<<"\a"<<"\n";
  86.     system("pause");
  87.     cout<<"\a"<<"\n";
  88.     system("pause");
  89.     cout<<"\a"<<"\n";
  90.     system("pause");
  91.     cout<<"\a"<<"\n";
  92.     system("pause");
  93.     cout<<"\a"<<"\n";
  94.      system("pause");
  95.     cout<<"\a"<<"\n";
  96.     system("pause");
  97.     cout<<"\a"<<"\n";
  98.     system("pause");
  99.     cout<<"\a"<<"\n";
  100.     system("pause");
  101.     cout<<"\a"<<"\n";
  102.     system("pause");
  103.     cout<<"\a"<<"\n";
  104.     system("pause");
  105.     cout<<"\a"<<"\n";
  106.     system("pause");
  107.     cout<<"\a"<<"\n";
  108.     system("pause");
  109.     cout<<"\a"<<"\n";
  110.     system("pause");
  111.     cout<<"\a"<<"\n";
  112.     system("pause");
  113.     cout<<"\a"<<"\n";
  114.     system("pause");
  115.     cout<<"\a"<<"\n";
  116.     system("pause");
  117.     cout<<"\a"<<"\n";
  118.     system("pause");
  119.     cout<<"\a"<<"\n";
  120.     system("pause");
  121.     cout<<"\a"<<"\n";
  122.     system("pause");
  123.     cout<<"\a"<<"\n";
  124.     system("pause");
  125.     cout<<"\a"<<"\n";
  126.     system("pause");
  127.     cout<<"\a"<<"\n";
  128.     system("pause");
  129.     cout<<"\a"<<"\n";
  130.     system("pause");
  131.     cout<<"\a"<<"\n";
  132.     system("pause");
  133.     cout<<"\a"<<"\n";
  134.      system("pause");
  135.     cout<<"\a"<<"\n";
  136.     system("pause");
  137.     cout<<"\a"<<"\n";
  138.     system("pause");
  139.     cout<<"\a"<<"\n";
  140.     system("pause");
  141.     cout<<"\a"<<"\n";
  142.     system("pause");
  143.     cout<<"\a"<<"\n";
  144.     system("pause");
  145.     cout<<"\a"<<"\n";
  146.     system("pause");
  147.     cout<<"\a"<<"\n";
  148.     system("pause");
  149.     cout<<"\a"<<"\n";
  150.     system("pause");
  151.     cout<<"\a"<<"\n";
  152.     system("pause");
  153.     cout<<"\a"<<"\n";
  154.     system("pause");
  155.     cout<<"\a"<<"\n";
  156.     system("pause");
  157.     cout<<"\a"<<"\n";
  158.     system("pause");
  159.     cout<<"\a"<<"\n";
  160.     system("pause");
  161.     cout<<"\a"<<"\n";
  162.     system("pause");
  163.     cout<<"\a"<<"\n";
  164.     system("pause");
  165.     cout<<"\a"<<"\n";
  166.     system("pause");
  167.     cout<<"\a"<<"\n";
  168.     system("pause");
  169.     cout<<"\a"<<"\n";
  170.     system("pause");
  171.     cout<<"\a"<<"\n";
  172.     system("pause");
  173.     cout<<"\a"<<"\n";
  174.      system("pause");
  175.     cout<<"\a"<<"\n";
  176.     system("pause");
  177.     cout<<"\a"<<"\n";
  178.     system("pause");
  179.     cout<<"\a"<<"\n";
  180.     system("pause");
  181.     cout<<"\a"<<"\n";
  182.     system("pause");
  183.     cout<<"\a"<<"\n";
  184.     system("pause");
  185.     cout<<"\a"<<"\n";
  186.     system("pause");
  187.     cout<<"\a"<<"\n";
  188.     system("pause");
  189.     cout<<"\a"<<"\n";
  190.     system("pause");
  191.     cout<<"\a"<<"\n";
  192.     system("pause");
  193.     cout<<"\a"<<"\n";
  194.     system("pause");
  195.     cout<<"\a"<<"\n";
  196.     system("pause");
  197.     cout<<"\a"<<"\n";
  198.     system("pause");
  199.     cout<<"\a"<<"\n";
  200.     system("pause");
  201.     cout<<"\a"<<"\n";
  202.     system("pause");
  203.     cout<<"\a"<<"\n";
  204.     system("pause");
  205.     cout<<"\a"<<"\n";
  206.     system("pause");
  207.     cout<<"\a"<<"\n";
  208.     system("pause");
  209.     cout<<"\a"<<"\n";
  210.     system("pause");
  211.     cout<<"\a"<<"\n";
  212.     system("pause");
  213.     cout<<"\a"<<"\n";
  214.     system("pause");
  215.      system("pause");
  216.     cout<<"\a"<<"\n";
  217.     system("pause");
  218.     cout<<"\a"<<"\n";
  219.     system("pause");
  220.     cout<<"\a"<<"\n";
  221.     system("pause");
  222.     cout<<"\a"<<"\n";
  223.     system("pause");
  224.     cout<<"\a"<<"\n";
  225.     system("pause");
  226.     cout<<"\a"<<"\n";
  227.     system("pause");
  228.     cout<<"\a"<<"\n";
  229.     system("pause");
  230.     cout<<"\a"<<"\n";
  231.     system("pause");
  232.     cout<<"\a"<<"\n";
  233.     system("pause");
  234.     cout<<"\a"<<"\n";
  235.     system("pause");
  236.     cout<<"\a"<<"\n";
  237.     system("pause");
  238.     cout<<"\a"<<"\n";
  239.     system("pause");
  240.     cout<<"\a"<<"\n";
  241.     system("pause");
  242.     cout<<"\a"<<"\n";
  243.     system("pause");
  244.     cout<<"\a"<<"\n";
  245.     system("pause");
  246.     cout<<"\a"<<"\n";
  247.     system("pause");
  248.     cout<<"\a"<<"\n";
  249.     system("pause");
  250.     cout<<"\a"<<"\n";
  251.     system("pause");
  252.     cout<<"\a"<<"\n";
  253.     system("pause");
  254.     cout<<"\a"<<"\n";
  255.      system("pause");
  256.     cout<<"\a"<<"\n";
  257.     system("pause");
  258.     cout<<"\a"<<"\n";
  259.     system("pause");
  260.     cout<<"\a"<<"\n";
  261.     system("pause");
  262.     cout<<"\a"<<"\n";
  263.     system("pause");
  264.     cout<<"\a"<<"\n";
  265.     system("pause");
  266.     cout<<"\a"<<"\n";
  267.     system("pause");
  268.     cout<<"\a"<<"\n";
  269.     system("pause");
  270.     cout<<"\a"<<"\n";
  271.     system("pause");
  272.     cout<<"\a"<<"\n";
  273.     system("pause");
  274.     cout<<"\a"<<"\n";
  275.     system("pause");
  276.     cout<<"\a"<<"\n";
  277.     system("pause");
  278.     cout<<"\a"<<"\n";
  279.     system("pause");
  280.     cout<<"\a"<<"\n";
  281.     system("pause");
  282.     cout<<"\a"<<"\n";
  283.     system("pause");
  284.     cout<<"\a"<<"\n";
  285.     system("pause");
  286.     cout<<"\a"<<"\n";
  287.     system("pause");
  288.     cout<<"\a"<<"\n";
  289.     system("pause");
  290.     cout<<"\a"<<"\n";
  291.     system("pause");
  292.     cout<<"\a"<<"\n";
  293.     system("pause");
  294.     cout<<"\a"<<"\n";
  295.      system("pause");
  296.     cout<<"\a"<<"\n";
  297.     system("pause");
  298.     cout<<"\a"<<"\n";
  299.     system("pause");
  300.     cout<<"\a"<<"\n";
  301.     system("pause");
  302.     cout<<"\a"<<"\n";
  303.     system("pause");
  304.     cout<<"\a"<<"\n";
  305.     system("pause");
  306.     cout<<"\a"<<"\n";
  307.     system("pause");
  308.     cout<<"\a"<<"\n";
  309.     system("pause");
  310.     cout<<"\a"<<"\n";
  311.     system("pause");
  312.     cout<<"\a"<<"\n";
  313.     system("pause");
  314.     cout<<"\a"<<"\n";
  315.     system("pause");
  316.     cout<<"\a"<<"\n";
  317.     system("pause");
  318.     cout<<"\a"<<"\n";
  319.     system("pause");
  320.     cout<<"\a"<<"\n";
  321.     system("pause");
  322.     cout<<"\a"<<"\n";
  323.     system("pause");
  324.     cout<<"\a"<<"\n";
  325.     system("pause");
  326.     cout<<"\a"<<"\n";
  327.     system("pause");
  328.     cout<<"\a"<<"\n";
  329.     system("pause");
  330.     cout<<"\a"<<"\n";
  331.     system("pause");
  332.     cout<<"\a"<<"\n";
  333.     system("pause");
  334.     cout<<"\a"<<"\n";
  335.      system("pause");
  336.     cout<<"\a"<<"\n";
  337.     system("pause");
  338.     cout<<"\a"<<"\n";
  339.     system("pause");
  340.     cout<<"\a"<<"\n";
  341.     system("pause");
  342.     cout<<"\a"<<"\n";
  343.     system("pause");
  344.     cout<<"\a"<<"\n";
  345.     system("pause");
  346.     cout<<"\a"<<"\n";
  347.     system("pause");
  348.     cout<<"\a"<<"\n";
  349.     system("pause");
  350.     cout<<"\a"<<"\n";
  351.     system("pause");
  352.     cout<<"\a"<<"\n";
  353.     system("pause");
  354.     cout<<"\a"<<"\n";
  355.     system("pause");



  356.    


  357. system("pause");
  358.     return 0;
  359.    
  360. }
複製代碼

TOP

本帖最後由 謝瀞儀 於 2014-8-23 12:17 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     float x,y;
  7.     cout<<"rectengle long(cm):";
  8.     cin>>x;
  9.     cout<<"rectengle height(cm):";
  10.     cin>>y;
  11.     cout<<"long"<<x<<"cm";
  12.     cout<<"\a"<<"\n";
  13.        system("pause");
  14.          cout<<"\a"<<"\n";
  15.             system("pause");
  16.          cout<<"\a"<<"\n";
  17.        system("pause");
  18.       cout<<"\a"<<"\n";
  19.     system("pause");
  20.     cout<<"height"<<y<<"cm's rectengle";
  21.     cout<<"\a"<<"\n";
  22.       system("pause");
  23.         cout<<"\a"<<"\n";
  24.           system("pause");
  25.             cout<<"\a"<<"\n";
  26.               system("pause");
  27.                 cout<<"\a"<<"\n";
  28.                   system("pause");
  29.                     cout<<"\a"<<"\n";
  30.                       system("pause");
  31.     cout<<"矩形周長="<<2*(x+y)<<","<<"\a"<<"\n";
  32.       cout<<"\a"<<"\n";
  33.           system("pause");
  34.             cout<<"\a"<<"\n";
  35.               system("pause");
  36.             cout<<"\a"<<"\n";
  37.           system("pause");
  38.         cout<<"\a"<<"\n";
  39.        system("pause");
  40.      cout<<"\a"<<"\n";
  41.       system("pause");
  42.        cout<<"\a"<<"\n";
  43.          system("pause");
  44.           cout<<"面積="<<x*y<<"cm2"<<"\n";
  45.             cout<<"\a"<<"\n";
  46.              system("pause");
  47.             cout<<"\a"<<"\n";
  48.           system("pause");
  49.         return 0;  
  50. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     float x,y;
  7.     cout<<"請輸入矩形的長(公分):";
  8.     cin>>x;
  9.     cout<<"請輸入矩形的寬(公分):";
  10.     cin>>y;
  11.     cout<<"長為"<< x << "公分,寬為"<< y <<"公分的矩形,周長為"<<(x+y)*2<<",面積為"<<x*y<<"平方公分‧"<<endl;
  12.     system ("pause");
  13.     return 0;
  14. }
複製代碼

TOP

返回列表