- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int a, b, c;
- re:
- cout<<"請任意輸入三個數: ";
- cin>>a>>b>>c;
- //1
- if(a>b and b>c)
- cout<<a<<">"<<c<<">"<<b<<endl;
- //2
- else if(a>c and c>b)
- cout<<a<<">"<<c<<">"<<b<<endl;
- //3
- else if(a==b and b>c)
- cout<<a<<"="<<b<<">"<<c<<endl;
- //4
- else if(a>c and c==b)
- cout<<a<<">"<<c<<"="<<b<<c<<endl;
-
- else if(b>a and a>c)
- cout<<b<<">"<<a<<">"<<c<<endl;
- //5
- else if(b>c and c>a)
- cout<<b<<">"<<c<<">"<<a<<endl;
-
- else if(b==c and c>a)
- cout<<b<<"="<<c<<">"<<a<<endl;
- //5
- else if(b>c and c==a)
- cout<<b<<">"<<c<<"="<<a<<endl;
-
- //6
- else if(c>a and a>b)
- cout<<c<<">"<<a<<">"<<b<<endl;
- //7
- else if(c>b and b>a)
- cout<<c<<">"<<b<<">"<<a<<endl;
-
- else if(c=b and b>a)
- cout<<c<<">"<<b<<">"<<a<<endl;
- //7
- else if(c>b and b==a)
- cout<<c<<">"<<b<<"="<<a<<endl;
-
- //8
- else
-
- cout<<a<<"="<<b<<"="<<c<<endl;
- goto re;
-
-
-
-
-
-
- system("pause");
- return 0;
- }
複製代碼 |