How would I compare a char? Say a do-while statement that checked if a char was equal to Y or y.
How would I compare a char? Say a do-while statement that checked if a char was equal to Y or y.
-PreludeCode:do { // Stuff } while ( ch == 'Y' || ch == 'y' );
My best code is written with the delete key.
You can make life easier by converting to either upper or lower case..but dont forget to #include <ctype.h>
char ch;
do
{
cout << "enter letter";
cin >> ch;
ch=toupper(ch);
...
}while (ch=='Y');
simple is always an understatement.....