Let's say I'm making a program for tuition class, I wanted to ask "Do you want to add another registration?"(the do while will be placed at the very outer of the whole program) and "Do you want to add individual subject" (do while will be placed at the outer of if/else statement, is it possible to use it twice?
do
{
cout<<"\nPlease enter category ( PT3 ) : ";
cin>>category;
if (strcmp(category ,"PT3")==0 || strcmp(category ,"pt3")==0)
{
cout<<"HELLO PHYSICS, CHEMISTRY!";
}
else
{
cout<<"ERROR!";
}
cout<<"\n\nDo you want to add another registration? (Y-YES / N-NO) : ";
cin>>registration ;
} while (registration =='Y');
I would also use toupper or tolower for registration. Also, make sure to validate the registration answer because what if the user types in a letter other than Y || N? i.e. other letters or lowercase Y||N