#include <iostream> #include <string> #include <cctype> using namespace std; //T
ID: 3619157 • Letter: #
Question
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
//These functions explained below
void spaces();
void introduction();
int main()
{
string sentence;
char response;
int words = 0;
do
{
getline(cin, sentence);
for(inti = 0; i < sentence.length(); i++)
{
if(isspace(sentence[i]) ||(sentence[i] == ',') ||(sentence[i] == '.'))
{
words++;
while(isspace(sentence[i]) ||(sentence[i] == ',') ||(sentence[i] == '.'))
{
i++;
}
}
}
cout << words << endl;
//Asks the user he would like to go again anything other than (Y ory) the program ends
cout << "Would you like to go again (Yor y): ";
cin >> response;
cout << endl;
cin.ignore();
}while(response == 'Y' || response== 'y');
return 0;
}