1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Zepler [3.9K]
2 years ago
10

Create the Following Menu in a loop so the menu will continually show until the user chooses to exit.AddMultiplyExitAdd a value

returning function to menu option 1 and menu option 2. This means that you will create two functions: an add function and a multiply function. The functions will receive two doubles and return a double. The following is code I have written to complete this assignment. When entering option 3 after entering option 1 or 2, it does not exit from the program. Also, the menu is appended instead of deleting everything and displaying the original menu.#include #include #include using namespace std;int options ();int option1 ();int option2 ();int option3 ();double addition (double num1, double num2);double multiplication (double num1, double num2);int main(){ int option = 0; cout << "1. Add" << endl; cout << "2. Multiply" << endl; cout << "3. Exit" << endl; cout << "Enter option 1 for addition, option 2 for multiplication, or option 3 to exit" "\nEnter an option: "; cin >> option; switch (option) { case 1:option1; int option1 ();{ double num1 = 0; double num2 = 0;// void int key = 0; cout << "\n Enter a number: "; cin >> num1; cout<< "\n Enter a second number: "; cin >> num2; double sum = addition(num1, num2); cout << "\n Sum is: " << sum <> key; system("cls");} break; case 2: option2; int option2 ();{ double num1 = 0; double num2 = 0;cout << "\n Enter a number:";cin >> num1;cout << "\n Enter a second number: ";cin >> num2;double product = multiplication(num1, num2); cout << "\n Product is: " << product << endl;system("cls");} break; case 3: option3; int option3(); {return 0;} break; default: cout << "\n Invalid number entered: ";}////do {main();}//while (option < 3);}double addition(double num1, double num2){ return num1 + num2;}double multiplication(double num1, double num2){ return num1*num2;}
Computers and Technology
1 answer:
ycow [4]2 years ago
4 0

Answer:

I have added the code again with the mistakes are corrected please see the comments in code. You have mistake in while loop condition.

#include <iostream>

#include <iomanip>

#include <cmath>

using namespace std;

int options ();

int option1 ();

int option2 ();

int option3 ();

double addition (double num1, double num2);

double multiplication (double num1, double num2);

int main()

{  

jump:

int option = 0;  

cout << "1. Add" << endl;

cout << "2. Multiply" << endl;

cout << "3. Exit" << endl;

 cout << "Enter option 1 for addition, option 2 for multiplication, or option 3 to exit" "Enter an option: ";

  cin >> option;

   switch (option)  

{  

case 1:option1;  

int option1 ();

{  

double num1 = 0;  

double num2 = 0;

// void int key = 0;  

cout << " Enter a number: ";  

cin >> num1;  

cout<< " Enter a second number: ";  

cin >> num2;  

double sum = addition(num1, num2);  

cout << " Sum is: " << sum <<endl;

 } break;  

 case 2: option2;  

 int option2 ();

 {  

 double num1 = 0;  

 double num2 = 0;

 cout << " Enter a number:";

 cin >> num1;

 cout << " Enter a second number: ";

 cin >> num2;

 double product = multiplication(num1, num2);

  cout << " Product is: " << product << endl;

  //system("cls");

  }  

  break;

   case 3: option3;  

   int option3();

    {

 return 0;

 }  

 break;  

 default: cout << " Invalid number entered: ";

 }

 //do {main();}

 //while (option < 3); //you have mistake in this loop please have a look

 while (option<3)

 {

  goto jump;

 }

 

 }

 double addition(double num1, double num2)

 {

  return num1 + num2;

  }

 double multiplication(double num1, double num2)

 {

  return num1*num2;

  }

Explanation:

You can also do this by using goto statement in switch case and menu will be repeated until the user not select to exit and now it will work with the loop as well.

I hope it will help you!

You might be interested in
Freeeee BRAINLIESTHBJHBJHB
andre [41]

Answer:A lot of people cry when they cut an onion. The trick is not to form an emotional bond.lol

4 0
3 years ago
Read 2 more answers
Which feature of a blog allows an author to interact and get feedback from his or her readers? link pingback commenting TweetMem
poizon [28]
Commenting. When someone comments of a blog the blog's writer can comment back, to answer questions, etc.
6 0
3 years ago
Please Help!!!<br> I keep getting this answer wrong
IgorC [24]

Answer:

I think its option a. and d.

Explanation:

option a. is right I'm sure.

option b. and c. are doubtful for me.

option d. can be true. but unlike a job letter, resumes carry a deeper view of the employee's accomplishments and qualifications.

but I still hold with option a. and b. if it's wrong please do inform, so I can refer.

5 0
3 years ago
You work on the marketing team for a software company. You do not work closely with the development team; however, you need to k
topjm [15]

Answer:

b. an e-mail

Explanation:

Based on the scenario being described within the question it can be said that the best electronic communication tool in this scenario would be an e-mail. Using e-mails you would be able to send detailed communication messages to all of the individuals that need to read that message in one e-mail. Thus allowing for fast and clear communication between all relevant parties. Both podcasts and Wiki's are used for providing information to clients, or the target audience but not for sharing info within the company.

4 0
3 years ago
unlike tv or newspaper ads, internet communications are interactive, and consumers can choose which messages and information the
Softa [21]

Companies often engage the services of Advertising firms to market their products. Company web offerings can be tailor-made for the consumers.

  • Advertising agencies are firms that makes, plan and handle the advertising needs of any business. They are known for handling negotiations creating tailored marketing campaigns.

A lot of agencies do not want to talk about pricing until they know what you can afford to spend.

Tailored content are delivered experiences that speak directly to customers.

This agencies uses their connections and resources to make one's campaign successful and cost-efficient.

Learn more from

brainly.com/question/23477855

5 0
2 years ago
Other questions:
  • . It is essential for a relay energized by alternating current to have A. many turns of small wire. B. a laminated core and a sh
    8·1 answer
  • You don't have policies that force settings for the look of users' computer desktops. Each user's chosen desktop settings are ap
    15·2 answers
  • At what x position are the ellipses drawn??? thanks ♡​
    6·1 answer
  • Beth would like to run an nmap scan against all of the systems on her organization's private network. These include systems in t
    15·1 answer
  • The elements of an integer-valued array can be set to 0 (i.e., the array can be cleared) recursively as follows: An array of siz
    14·1 answer
  • Which feature is used to change how a presentation moves from slide to slide?
    14·1 answer
  • Complete the statement below using the correct term.<br>Website managers use<br>every day​
    11·2 answers
  • What is the purpose of a project overview?
    8·2 answers
  • ________ is interpreted. Group of answer choices A. Python B. C C. C D. Ada E. Pascal
    13·1 answer
  • Online platforms that allow users to represent themselves via a profile on a web site and provide and receive links to other net
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!