返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     re:
  6.     int a,b,c,d;
  7.     cout<<"請依序輸入四個數:"<<endl;
  8.     cin>>a>>b>>c>>d;
  9.     if(a>b&&a>c&&a>d)
  10.         cout<<"四數中最大的數為: "<<a<<endl;
  11.     else if(b>a&&b>c&&b>d)
  12.         cout<<"四數中最大的數為: "<<b<<endl;
  13.     else if(c>a&&c>b&&c>d)
  14.         cout<<"四數中最大的數為: "<<c<<endl;
  15.     else if(d>a&&d>b&&d>c)
  16.         cout<<"四數中最大的數為: "<<c<<endl;
  17.     else
  18.         cout<<"數字重複!"<<endl;
  19.     goto re;

  20.     system("pause");
  21.     return 0;
  22. }
複製代碼

TOP

返回列表