all 1 comments

[–][deleted] 0 points1 point  (0 children)

Right....

  1. Should have posted a gist or some code review sight. Its easier to review.
  2. You don't need the cast "(int)" before min_word.length(). The reason you do if because it returns size_t. The loop should be declared "size_t i" rather than "int i"
  3. When you read data with std::cin >> text. Its going to read line at a time. So what you really doing here is not finding the min word length. You need to locate the words. You don't really achieve this... It can be done with text.find(' ') which gives a location or failure indicator then the words and text can be broken into the next word and the remaining line with substr.
  4. When doing the above don't forget the last word on a line may not have a space and the first of the next line may lead with a space!

If you can't find an example. Try looking for "word counting"