Monday, 22 December 2014

cin which can take SPACE as input

http://stackoverflow.com/questions/24028603/taking-space-separated-string-input-in-c

eg

1down voteaccepted
#include <iostream>
#include <string>

int main(){

std::string str;
std::getline(std::cin, str);
std::cout << "I just read in " << str;

return 0;}


No comments:

Post a Comment