Can anybody please tell me what is wrong with this piece of code?
std::string query;
std::cout << "Enter the Query String :";// Type something with spaces here. e.g ( "financial instruments being traded on the American stock exchange" );
while (std::cin >> query )
{
std::cout << query <<std::endl;
}
The objective is to tokenize the string at whitespace as it is read from cin.
e.g the output should be
Enter the Query String :financial instruments being traded on the American stock exchange
financial
instruments
being
traded
on
the
American
stock
exchange