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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started