Hi,
I think this problem has been asked before but please help me with this specific question.
Word count problem to show the count of each word.
I found this code on the internet:
map<string,int> wordCounter;
string str;
while( cin >> str )
wordCounter[str]++;
The thing is, I don't want to use standard input. I already have a string defined above.. Say str = "Hello Check Hello Hello Check One Two Three"
How can I replace while( cin >> str ) to not use cin but still populate the wordCounter?
Thank you
Thank you.
Stringstream is what I was looking for :)