Untitled

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <iterator> void readAlpha(const std::string strToRead) { std::istringstream iss(strToRead); std::string str; for (std::string::iterator pos, prev; std::getline(iss, str);) { for (pos = std::find_if(str.begin(), str.end(), isalpha); pos != str.end(); pos = std::find_if(prev, str.end(), isalpha)) { prev = std::find_if_not(pos, str.end(), isalpha); std::string token(pos, prev); std::cout << token << std::endl; } } } int main() { using namespace std; string sentence = "And I feel fine..."; istringstream iss(sentence); vector<string> tokens; copy(istream_iterator<string>(iss), istream_iterator<string>(), back_inserter(tokens)); /*copy(istream_iterator<string>(iss), istream_iterator<string>(), ostream_iterator<string>(cout, "\n")); */ for (auto s: tokens){ cout << s<<endl; } }
Editor Settings
Theme
Key bindings
Full width
Lines