| <<< | Index | >>> |
#include <iostream>
int main()
{
std::cout << "Do you want to proceed (y or n)?\n";
char answer = 0;
std::cin >> answer; // get answer from user
switch ( answer ) {
case 'y':
return true;
case 'n':
return false;
default:
std::cout << "Sorry, I don't understand\n";
std::cout << "I'll take that for a no";
return false;
}
}
| <<< | Index | >>> |