Hey guys I need help in counting the number of words in this input (use isspace( ) to find breaks between words), the phrases, and the sentences. Can someone please help me out ? Here is my code so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include <string>
#include <cctype>
int main()
{
std::string result ;
std::string line ;
std::string length;
std::cout << "Enter text: " << std::endl;
while (std::getline(std::cin, line) && !line.empty() )
{
result += line + " " ;
}
std::cout << result << '\n';
return 0;
}