重载比较两个或三个数的大小

想利用重载输入两个或三个数比较大小
#include <iostream>
using namespace std;
int main()
{
    int max(int a,int b,int c);
    int max(int a,int b);
    cout<<"最大的值为:"<<endl;
    int a,b,c;
    cin>>a>>b>>c;
    cout<<"max="<<max(a,b,c)<<endl;
    cin>>a>>b;
    cout<<"max="<<max(a,b)<<endl;
    return 0;
}
int max(int a,int b,int c)
{
    if(b>a)a=b;
    if(c>a)a=c;
    return a;
}
int max(int a,int b)
{
    return (a>b?a:b);
}

img

书上是给定值,想尝试输入值比较大小

看下任务管理器 应该还有同样的程序运行 没有关掉