Skip to content

Instantly share code, notes, and snippets.

@JAChapmanII
Created September 13, 2013 16:35
Show Gist options
  • Save JAChapmanII/6552983 to your computer and use it in GitHub Desktop.
Save JAChapmanII/6552983 to your computer and use it in GitHub Desktop.
stringstream input
#include <iostream>
#include <sstream>
using namespace std;
int main() {
stringstream ss;
ss << "5 10 20";
cin.rdbuf(ss.rdbuf());
int n;
while(cin >> n) {
cout << "n: " << n << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment