Board logo

標題: 五則運算 (二) [打印本頁]

作者: tonyh    時間: 2014-8-23 11:25     標題: 五則運算 (二)

本帖最後由 tonyh 於 2014-8-23 11:36 編輯

[attach]951[/attach]
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cout<<"請輸入x的值: ";
  8.     cin>>x;
  9.     cout<<"請輸入y的值: ";
  10.     cin>>y;
  11.     cout<<x<<" + "<<y<<" = "<<x+y<<endl;
  12.     cout<<x<<" - "<<y<<" = "<<x-y<<endl;
  13.     cout<<x<<" * "<<y<<" = "<<x*y<<endl;
  14.     cout<<x<<" / "<<y<<" = "<<x/y<<endl;
  15.     cout<<x<<" % "<<y<<" = "<<x%y<<endl;
  16.     system("pause");
  17.     return 0;   
  18. }
複製代碼

作者: 洪振庭    時間: 2014-8-23 11:32

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cout<<"x=";
  8.     cin>>x;
  9.     cout<<"y=";
  10.     cin>>y;
  11.     cout<<x<<"+"<<y<<"="<<x+y<<endl;
  12.     cout<<x<<"-"<<y<<"="<<x-y<<endl;
  13.     cout<<x<<"*"<<y<<"="<<x*y<<endl;
  14.     cout<<x<<"/"<<y<<"="<<x/y<<endl;
  15.     cout<<x<<"%"<<y<<"="<<x%y<<endl;
  16.     system("pause");
  17.     return 0;
  18. }
複製代碼

作者: 梁和雋    時間: 2014-8-23 11:32

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x;
  7.     int y;
  8.     cout<<"請輸入X"<<endl;
  9.     cin>>x;
  10.     cout<<"請輸入Y"<<endl;
  11.     cin>>y;
  12.     cout<<"x+y="<<x+y<<endl;
  13.     cout<<"x-y="<<x-y<<endl;
  14.     cout<<"x*y="<<x*y<<endl;
  15.     cout<<"x/y="<<x/y<<endl;
  16.     cout<<"x%y="<<x%y<<endl;

  17.     system("pause");
  18.     return 0;
  19. }
複製代碼

作者: 李大全    時間: 2014-8-23 11:33

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cout<<"x=";
  8.     cin>>x;
  9.     cout<<"y=";
  10.     cin>>y;
  11.     cout<<x<<"+"<<y<<"="<<x+y<<endl;
  12.     cout<<x<<"-"<<y<<"="<<x-y<<endl;
  13.     cout<<x<<"*"<<y<<"="<<x*y<<endl;
  14.     cout<<x<<"/"<<y<<"="<<x/y<<endl;
  15.     cout<<x<<"%"<<y<<"="<<x%y<<endl;
  16.     system("pause");
  17.     return 0;
  18. }
複製代碼

作者: 謝瀞儀    時間: 2014-8-23 11:42

本帖最後由 謝瀞儀 於 2014-8-23 11:45 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cout<<"x=";
  8.     cin>>x;
  9.     cout<<"y=";
  10.     cin>>y;
  11.     cout<<x<<"-"<<y<<"="<<x-y<<"\a"<<"\n";
  12.     system("pause");
  13.     cout<<x<<"*"<<y<<"="<<x*y<<"\a"<<"\n";
  14.     system("pause");
  15.     cout<<x<<"/"<<y<<"="<<x/y<<"\a"<<"\n";
  16.     system("pause");
  17.     cout<<x<<"+"<<y<<"="<<x+y<<"\a"<<"\n";
  18.     system("pause");
  19.     cout<<x<<"%"<<y<<"="<<x%y<<"\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.     return 0;
  62.    
  63. }
複製代碼

作者: 李知易    時間: 2014-8-23 11:45

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,y;
  7.     cout<<"請輸入x的值";
  8.     cin>>x;
  9.     cout<<"請輸入y的值";
  10.     cin>>y;
  11.     cout<<x<<"+"<<"y"<<"=\a"<<x+y<<endl;
  12.     cout<<x<<"-"<<y<<"=\a"<<x-y<<endl;
  13.     cout<<x<<"*"<<y<<"=\a"<<x*y<<endl;
  14.     cout<<x<<"/"<<y<<"=\a"<<x/y<<endl;
  15.     cout<<x<<"%"<<y<<"=\a"<<x%y<<endl;
  16.     system ("pause");
  17.     return 0;
  18. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2