hello everyone, im currently writing a code for a library, and i needed help trying to figure out how to write a code to check an object in or out. im how would i make it user friendly to simply press Y OR N TO CHECK A BOOK IN OR OUT. I JUST NEED A SAMPLE IF ANYone can help me out, i would surely appreciate it

char answer;
cout << "Enter Y or N\n";
cin >> answer;
cin.ignore(); // ignore '\n'
answer  = tupper(answer); // convert to upper case
if( answer == 'Y')
{
   // blabla
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.