- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int a,b,c;
- cout<<"請輸入第1個數:";
- cin >> a;
- cout<<"請輸入第2個數:";
- cin >> b;
- cout<<"請輸入第3個數:";
- cin >> c;
- if(a > b && b > c)
- {
- cout<<a<<">"<<b<<">"<<c<<endl;
- }else if(a > c && c > b)
- {
- cout<<a<<">"<<c<<">"<<b<<endl;
- }else if(b > a && a > c)
- {
- cout<<b<<">"<<a<<">"<<c<<endl;
- }else if(b > c && c > a)
- {
- cout<<b<<">"<<c<<">"<<a<<endl;
- }else if(c > a && a > b)
- {
- cout<<c<<">"<<a<<">"<<b<<endl;
- }else if(c > a && a > b)
- {
- cout<<c<<">"<<b<<">"<<a<<endl;
- }else
- {
- cout<<"其中2數相等或3數相等!"<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |