本帖最後由 林宇翔 於 2014-4-5 13:25 編輯
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int a,b,c,d,e;
- cout << "請輸入第一個數字:";
- cin >> a;
- cout << "請輸入第二個數字:";
- cin >> b;
- cout << "請輸入第三個數字:";
- cin >> c;
- cout << "請輸入第四個數字:";
- cin >> d;
- e= a;
- e= (e < b)? e : b;
- e= (e < c)? e : c;
- e= (e < d)? e : d;
- cout << "最小值" << g <<endl;
- system ("pause");
- return 0;
- }
複製代碼- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int a,b,c,d,e;
- cout << "請輸入第一個數字:";
- cin >> a;
- cout << "請輸入第二個數字:";
- cin >> b;
- cout << "請輸入第三個數字:";
- cin >> c;
- cout << "請輸入第四個數字:";
- cin >> d;
- e= a;
- e= (e > b)? e : b;
- e= (e > c)? e : c;
- e= (e > d)? e : d;
- cout << "最大值" << g <<endl;
- system ("pause");
- return 0;
- }
複製代碼 |