Based on the code that I already have, please help me complete it. I am attempting to use 2 functions with a created menu. Pls do not use another method of fixing my code but go with the code already given, my current code is giving error display for the switch statement. Proper parameters for the functions in the switch statement need to be adjusted. And the second function in the switch statement also has overloaded that need to get fixed. This code is something that Im working on my own, non related to school work. It is part of a book that I bought to continue practicing my coding skills through the summer so pls follow my requests, thank you #include #include #include using namespace std; template T absolute(T val) { if (val < 0) return val * (-1); return val; } void integer_call(int &x1, int &x2, int &x1_holding, int &x2_holding); void double_call(double &y1, double &y2, double &y1_holding, double &y2_holding); int main() { cout << fixed << showpoint << setprecision(2); do { cout << "-------------------------------------------------\n"; cout << "\tAbsolute Value Template" << endl; cout << "1) To test integers press 1." << endl; cout << "2) To test doubles press 2." << endl; cout << "0) To Quit" << endl; char option[20]; cin >> option; switch (atoi(option)) { case 1: integer_call(); break; case 2: double_call(); break; default: exit(0); } } while (true); cout << endl; system("pause"); return 0; void integer_call(int &x1, int &x2, int &x1_holding, int &x2_holding) { cout << "Please enter the 1st number as an integer: "; cin >> x1; cout << "Please enter the 2nd number as an integer: "; cin >> x2; x1_holding = absolute(x1); cout << "\nAbsolute value of 1st number " << x1 << " is: " << x1_holding << endl; x2_holding = absolute(x2); cout << "Absolute value of 2nd number " << x2 << " is: " << x2_holding << endl; } void double_call(double &y1, double &y2, double y1_holding, double y2_holding) { cout << "Please enter the 1st number as a double: "; cin >> y1; cout << "Please enter the 2nd number as a double: "; cin >> y2; y1_holding = absolute(y1); cout << "\nAbsolute value of 1st number " << y1 << " is: " << y1_holding << endl; y2_holding = absolute(y2); cout << "\nAbsolute value of 2nd number " << y2 << " is: " << y2_holding << endl; }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Based on the code that I already have, please help me complete it. I am attempting to use 2 functions with a created menu. Pls do not use another method of fixing my code but go with the code already given, my current code is giving error display for the switch statement. Proper parameters for the functions in the switch statement need to be adjusted. And the second function in the switch statement also has overloaded that need to get fixed.

This code is something that Im working on my own, non related to school work. It is part of a book that I bought to continue practicing my coding skills through the summer so pls follow my requests, thank you

#include <iostream>

#include <string>

#include <iomanip>

using namespace std;

template <class T> T absolute(T val)

{ if (val < 0) return val * (-1); return val; }

void integer_call(int &x1, int &x2, int &x1_holding, int &x2_holding);

void double_call(double &y1, double &y2, double &y1_holding, double &y2_holding);

int main()

{

cout << fixed << showpoint << setprecision(2);

do

{

cout << "-------------------------------------------------\n";

cout << "\tAbsolute Value Template" << endl;

cout << "1) To test integers press 1." << endl;

cout << "2) To test doubles press 2." << endl;

cout << "0) To Quit" << endl;

char option[20]; cin >> option;

switch (atoi(option))

{

case 1: integer_call(); break;

case 2: double_call(); break;

default: exit(0);

}

}

while (true);

cout << endl;

system("pause");

return 0; 

void integer_call(int &x1, int &x2, int &x1_holding, int &x2_holding)

{

cout << "Please enter the 1st number as an integer: ";

cin >> x1;

cout << "Please enter the 2nd number as an integer: ";

cin >> x2;

x1_holding = absolute(x1);

cout << "\nAbsolute value of 1st number " << x1 << " is: " << x1_holding << endl;

x2_holding = absolute(x2);

cout << "Absolute value of 2nd number " << x2 << " is: " << x2_holding << endl;

}

void double_call(double &y1, double &y2, double y1_holding, double y2_holding)

{

cout << "Please enter the 1st number as a double: ";

cin >> y1;

cout << "Please enter the 2nd number as a double: ";

cin >> y2;

y1_holding = absolute(y1);

cout << "\nAbsolute value of 1st number " << y1 << " is: " << y1_holding << endl;

y2_holding = absolute(y2);

cout << "\nAbsolute value of 2nd number " << y2 << " is: " << y2_holding << endl;

}

 

 

 

Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY