Could please help me in the code,of how to extract the no of words in each sentence(if there are 2 or more sentence).But i want the code to use string function?????????
koculan 0 Newbie Poster
Recommended Answers
Jump to Postif you post the code that YOU have tried then we can help you in debugging and solving the problem. but you cant just expect spoon feeding here..
ps: i just got ripped left-right-center for trying to solve a similar thread
Jump to PostIt is easier to use std::stringstream class to do that
#include <sstream> <other includes here> ... string sentence = "Once upon a time there were three little pigs"; string word; vector<string> array; stringstream stream(sentence); while( stream >> word) { array.push_back(word); }
All 7 Replies
Agni 370 Practically a Master Poster Featured Poster
koculan 0 Newbie Poster
koculan 0 Newbie Poster
Agni 370 Practically a Master Poster Featured Poster
Agni 370 Practically a Master Poster Featured Poster
koculan 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.