Code:
#include <iostream>
using std::cout;
using std::cin;
bool ContinueYN(); // Prototype
int main()
{
bool data;
data = ContinueYN();
if(data)
cout << "Good job: YES";
else
cout << "OK: NO";
return 0;
}
bool ContinueYN()
{
char c = ' ';
while( c != 'y' || c != 'Y' || c != 'n' || c != 'N' )
{
cout << "Continue? (Y/N): ";
cin.get(c); // Get character from user
cin.ignore(1, '\n'); // Skip newline
if( c == 'y' || c == 'Y' )
return true;
else if( c == 'n' || c == 'N' )
return false;
}
return false; // Will not happen, but is more aesthetically correct
}