- #include<cstdlib>
- #include<iostream>
- using namespace std;
- int main()
- {
- int a,b,c,d,e,f,g,h,i;
- cout<<"請依序輸入三個數:";
- cin>>a>>b>>c;
- d = a>b?a:b;
- e = d>c?d:c;
- f = a>b?a:b;
- g = d>c?d:c;
- h = a>b?a:b;
- i = d>c?d:c;
-
-
-
-
-
-
- cout<<"三數中最大的數為: "<<e<<endl<<endl;
- cout<<"三數中中間的數為: "<<d<<endl<<endl;
- cout<<"三數中最小的數為: "<<f<<endl<<endl;
-
-
- system("pause");
- return 0;
- }
複製代碼 |