Created
September 17, 2016 00:16
-
-
Save benblack769/d9bd24586e5474bc7afe23d4e191a631 to your computer and use it in GitHub Desktop.
This file contains 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> | |
#include <sstream> | |
using namespace std; | |
string next_line(){ | |
//breaks if there is no line to get | |
string line; | |
getline(cin,line); | |
return line; | |
} | |
vector<string> get_lines_until_end(){ | |
vector<string> strs; | |
string line; | |
while(getline(cin,line)){ | |
strs.push_back(line); | |
} | |
return strs; | |
} | |
vector<string> split(string line){ | |
stringstream ss(line); // Insert the string into a stream | |
vector<string> tokens; // Create vector to hold our words | |
string buf; | |
while (ss >> buf){ | |
tokens.push_back(buf); | |
} | |
return tokens; | |
} | |
//also remember the standard library functions | |
//stoi (string to int) | |
//stod (string to double) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment