ex0522.cpp
来自「practice c++, it is from the book http:/」· C++ 代码 · 共 25 行
CPP
25 行
// Programming with C++, Second Edition, by John R. Hubbard
// Copyright McGraw-Hill, 2000
// Example 5.22 on page 109
// Overloading the max() function
#include <iostream> // defines the cin and cout objects
using namespace std;
int max(int, int);
int max(int, int, int);
int main()
{ cout << max(99,77) << " " << max(55,66,33);
}
int max(int x, int y)
{ // returns the maximum of the two given integers:
return (x > y ? x : y);
}
int max(int x, int y, int z)
{ // returns the maximum of the three given integers:
int m = (x > y ? x : y); // m = max(x,y)
return (z > m ? z : m);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?