// PL2/max2.cpp // overloading the max function // Niels Walet, last updated 04/12/2019 #include<iostream> double max(double number1, double number2) { if(number1>number2) return number1; else return number2; } int max(int number1, int number2) { if(number1>number2) return number1; else return number2; } int main() { int integer1{1}; int integer2{2}; double real1{4.}; double real2{3.}; std::cout<<max(integer1,integer2)<<std::endl <<max(real1,real2)<<std::endl; return 0; } |