Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help debugging a code This code has errors in it and I need to fix them so that it runs properly #include #include using

Need help debugging a code

This code has errors in it and I need to fix them so that it runs properly

#include

#include

using namespace std;

int main()

{

int choice;

int amt;

do {

cout << "Make a choice from the following menu:" << endl;

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

cout << " 2. Delete a user" << endl;

cout << " 3. Modify a user" << endl;

cout << " 4. View a user" << endl;

cout << " 5. Contact a user" << endl;

cin >> choice;

// I want to keep looping if the choice is outside of 1-5,

} while (choice < 0 && choice > 5);

switch (choice) {

case 1: {

cout << "You chose 'add a user'" << endl;

}

case 2: {

cout << "You chose 'delete a user'" << endl;

}

case 3: {

cout << "You chose 'modify a user'" << endl;

}

case 4: {

cout << "You chose 'view a user'" << endl;

}

case 5: {

cout << "How many users? ";

cin >> amt;

cout << "Enter users:" << endl;

//I want to grab a name for each of the users that

//the user gives me and output it with "Contacting "

for (int i = 0;i <= amt;i++); {

string name;

cin >> name;

cout << "Contacting " << name << endl;

}

break;

}

default: {

cout << "Unknown choice: " << choice << endl;

break;

}

}

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago