⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex0522.cpp

📁 《C++编程习题与解答》书中所有例题与习题的源代码
💻 CPP
字号:
//  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -