- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int a,b,c;
- re:
- system("cls");
- cout<<"請任意輸入三個數:";
- cin>>a >>b >>c ;
- if(a>b && b>c)
- {
- cout<<a<<">"<<b<<">"<<c<<endl;
- }else if(a>b && b<c && a>c)
- {
- cout<<a<<">"<<c<<">"<<b<<endl;
- }else if(a<b && b>c && a>c)
- {
- cout<<b<<">"<<a<<">"<<c<<endl;
- }else if(a<b && b>c && a<c)
- {
- cout<<b<<">"<<c<<">"<<a<<endl;
- }else if(a>b && b<c && a<c)
- {
- cout<<c<<">"<<a<<">"<<b<<endl;
- }else if(a<b && b<c && a<c)
- {
- cout<<c<<">"<<b<<">"<<a<<endl;
- }else
- {
- cout<<"其中兩個數或三個數相等。"<<endl;
- }
- system("pause");
- goto re;
- system("pause");
- return 0;
-
- }
複製代碼 |