Get empty input

Say I have,

1
2
3
4
5
6
7
8
using std::string;

string temp_id;
string temp_name;
std::cout << "ID\n> ";
std::cin >> temp_id;
std::cout << "Name\n> ";
std::cin >> temp_name;


If user simply taps ENTER for either value, how can I store that as an empty string? I keep tapping enter, and it keeps expecting characters.
Last edited on
Sounds like you want to use std::getline.

http://www.cplusplus.com/reference/string/string/getline/
Topic archived. No new replies allowed.