Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include using namespace std; int main() { map mp; map ::iterator it, it1; int choice; string author, title; while (1) { cout

#include #include #include #include using namespace std;

int main() { map mp; map::iterator it, it1; int choice; string author, title; while (1) { cout<<" ---------------------"<>choice; switch(choice) { case 1: getchar(); cout<<"Enter Author Name to be inserted: "; getline(cin, author); cout<<"Enter Book Title to be inserted: "; getline(cin, title); mp.insert (pair(author, title)); break; case 2: getchar(); cout<<"Enter Author Name to be deleted: "; getline(cin, author); it=mp.find(author); if (it != mp.end()) { cout<<"Element found and deleted"<

break; case 5: cout<<"Size of the Map: "< "<<(*it).second<

When I input choice with some letters such as "p" "af" ...like that, this program will be endless loop. How can I fix it?

Thank you1

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

Sell the quality of your brand or products.

Answered: 1 week ago