how can i display words form a long sentence.
example :(lets assume that if u find two spaces that is word)
INPUT:the Indian school boys are very good compare to other countries.
OUTPUT: the Indian
school boys
are
very
good
compare to
other countries
i am solving these way but it takes only one space to divide a word.
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
int main()
{
std::vector <std::string> words;
std::string str;
std::cout << "Read from a file!" << std::endl;
std::ifstream fin("thisfile.txt");
while (fin >> str)
{
words.push_back(str);
}
fin.close();
for (int i = 0; i < words.size(); ++i)
std::cout << words.at(i) << std::endl;