shiti1_5_2.cpp
来自「为初学者提供的最佳的C++程序设计源程序库」· C++ 代码 · 共 30 行
CPP
30 行
#include<iostream.h>
template<class T>
T Maximum(T value1,T value2,T value3)
{
T max=value1;
if(value2>max)
max=value2;
if(value3>max)
max=value3;
return max;
}
void main()
{
int int1,int2,int3;
cout<<"Input three integer value is: ";
cin>>int1>>int2>>int3;
cout<<"The maximum integer value is: "
<<Maximum(int1,int2,int3)<<endl;
double double1,double2,double3;
cout<<"Input three double value is: ";
cin>>double1>>double2>>double3;
cout<<"The maximum double value is: "
<<Maximum(double1,double2,double3)<<endl;
char char1,char2,char3;
cout<<"Input three char value is: ";
cin>>char1>>char2>>char3;
cout<<"The maximum char value is: "
<<Maximum(char1,char2,char3)<<endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?