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 using namespace std;

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; }student submitted image, transcription available below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!