Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

break input stream into words

int countWords(string str) {
    stringstream s(str);
    string word;
    int count = 0;
    while (s >> word)
        count++;
    return count;
}
 
PREVIOUS NEXT
Tagged: #break #input #stream #words
ADD COMMENT
Topic
Name
6+7 =