Last active
April 4, 2021 00:50
-
-
Save AndyNovo/b3447d92c61b8f1c5506 to your computer and use it in GitHub Desktop.
A simple function example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
string prompt_user(string input_prompt){ | |
string reply; | |
cout << input_prompt << endl; | |
cin >> reply; //only use one of these two lines. | |
//getline(cin, reply); | |
return reply; | |
}; | |
int main(){ | |
string response = prompt_user("How are you doing today?"); | |
cout << "You said: " << response << endl; | |
response = prompt_user("Is it your birthday?"); | |
cout << "You said: " << response << endl; | |
return 0; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment