Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created August 31, 2015 23:42
Show Gist options
  • Save AndyNovo/3a83311de6966c01cb2f to your computer and use it in GitHub Desktop.
Save AndyNovo/3a83311de6966c01cb2f to your computer and use it in GitHub Desktop.
Simple prompt, but without using standard namespace.
#include<iostream>
std::string prompt_user(std::string input_prompt){
std::string reply;
std::cout << input_prompt << std::endl;
//std::getline(std::cin, reply);
std::cin >> reply;
return reply;
};
int main(){
std::string response = prompt_user("How are you doing today?");
std::cout << "You said: " << response << std::endl;
response = prompt_user("Is it your birthday?");
std::cout << "You said: " << response << std::endl;
return 0;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment