Replace the code in the body of the main function with a call to a function named getResponse. Put the original code in the function.
#include <iostream>
using namespace std;
int main(){
char response = '!';
do{
cout << "Please type y or n: ";
cin >> response;
} while( (response != 'y') && (response != 'n'));
cout << "You entered " << response << endl;
return 0;
}
Your results should at least have the following code:
#include <iostream>
using namespace std;
int main(){
char response = '!';
cout << "You entered " << response << endl;
return 0;
}