Question: 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

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!