AP3_(1).cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <iostream> using namespace std; int big(int x, int y) { if (y > x) { if (y < 100) return y; } else { if (x < 100) return x; } return 100; } int big(int x, int y, int limit) { if (y > x) { if (y < limit) return y; } else { if (x < limit) return x; } return limit; } int main() { int x = big(3, 5); int y = big(300, 60); int z = big(30, 60, 50); cout << x << ' ' << y << ' ' << z << endl; } | cs |
AP3_(2).cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int big(int x, int y, int limit = 100) { if (y > x) { if (y < limit) return y; } else { if (x < limit) return x; } return limit; } int main() { int x = big(3, 5); int y = big(300, 60); int z = big(30, 60, 50); cout << x << ' ' << y << ' ' << z << endl; } | cs |
'Programming > 명품 C++ Programming' 카테고리의 다른 글
| 명품 C++ Programming 실습문제 6장 5번 (0) | 2018.05.10 |
|---|---|
| 명품 C++ Programming 실습문제 6장 4번 (0) | 2018.05.10 |
| 명품 C++ Programming 실습문제 6장 2번 (0) | 2018.05.10 |
| 명품 C++ Programming 실습문제 6장 1번 (0) | 2018.05.09 |
| 명품 C++ Programming 6장 OpenChallenge (0) | 2018.05.09 |