Trying to get the cin function to work in the menu without interfering with the design but having errors. What is the best to use the cin choice function that ask the user to make a choice inside the menu

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

Trying to get the cin function to work in the menu without interfering with the design but having errors. What is the best to use the cin choice function that ask the user to make a choice inside the menu


#include "stdafx.h"
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <vector>
#include <cctype>
#include <iterator>
#include <algorithm>
#include <cmath>
#include "ConsoleApplication13.h"

 

using namespace std;

string donor_name;
double donor_amount;
int choice;

int main()
{
cout << " \n\n ******************************************************" << endl;
cout << " ******************************************************" << endl;
cout << " ** **" << endl;
cout << " ** **" << endl;
cout << " ** 1. Add a contributor. **" << endl;
cout << " ** 2. Search and update contributor. **" << endl;
cout << " ** 3. Display all Donor information. **" << endl;
cout << " ** 4. Department Total. **" << endl;
cout << " ** 5. Delete Donation. **" << endl;
cout << " ** 6. Exit. **" << endl;
cout << " ** **" << endl;
cout << " ** Choose one: " <<choice << " **" << endl;
cout << " ** **" << endl;
cout << " ** **" << endl;
cout << " ** **" << endl;
cout << " ******************************************************" << endl;
cout << " ******************************************************" << endl;
cin >> choice;


switch (choice)
{
here:
case 1:
cout << "\n===Record donor information===\n";
cout << "\nPlease enter the name of the donor: \n";
cin >> donor_name;
cout << "\nPlease enter amount donor contributed: \n";
cin >> donor_amount;
cout << "\n\n=Donation to organization= \n";
cout << "\n1.)NHTS 2)PBL 3)PTK 4)SEA\n";
system("CLS");
goto here;
case 2:
cout << "==Search and update contributor==";
system("CLS");
goto here;

case 3:
cout << "==Display all donations==";
system("CLS");
goto here;
case 4:
cout << "==Total Contributions==";
system("CLS");
goto here;
case 5:
cout << "==Delete a donor donation==";

system("CLS");
goto here;
case 6:
exit(0);

}

system("pause");
system("CLS");
return 0;
}

 

Expert Solution
steps

Step by step

Solved in 2 steps

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