Question
:Optimize it using function template #include using namespace std; int maximumInt(int v1, int v2, int v3) { int maximumValue = v1; if (v2 > maximumValue)
:Optimize it using function template
#include
int maximumInt(int v1, int v2, int v3) { int maximumValue = v1; if (v2 > maximumValue) maximumValue = v2; if (v3 > maximumValue) maximumValue = v3; return maximumValue; }
double maximumDouble (double v1, double v2, double v3) { double maximumValue = v1; if (v2 > maximumValue) maximumValue = v2; if (v3 > maximumValue) maximumValue = v3; return maximumValue; } char maximumchar(char v1, char v2, char v3) { char maximumValue = v1; if (v2 > maximumValue) maximumValue = v2; if (v3 > maximumValue) maximumValue = v3; return maximumValue; } int main() { int i1, i2, i3; cout << "input three integer values:"; cin >> i1 >> i2 >> i3; cout << "The maximum integer value is:" << maximumInt(i1, i2, i3);
double d1, d2, d3; cout << " Input three double values: "; cin >> d1 >> d2 >> d3; cout << "The maximum double value is:" << maximumDouble(d1, d2, d3);
char c1, c2, c3; cout << " Input three double char:"; cin >> c1 >> c2 >> c3; cout << " The maximum character value is" << maximumchar(c1, c2, c3) << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started