This is the latest version of all my programs so far.

This commit is contained in:
Charles Descamps 2024-09-11 14:47:24 -07:00
parent 631aa69e32
commit 28e820292f
6 changed files with 299 additions and 8 deletions

View file

@ -29,6 +29,7 @@ int main(int argc, char **argv)
{
int numSentences = 0;
int numSpaces = 0;
int wordTotal = 0;
string tempString;
// ask user for number of sentences
cout << "How many sentences would you like to enter?" << '\n';
@ -55,11 +56,15 @@ int main(int argc, char **argv)
}
// add an extra 'word' because of the end.
numSpaces = numSpaces + 1;
// total the number of words.
wordTotal = wordTotal + numSpaces;
// print out to the user
cout << "Sentence " << sentenceIterator + 1 << " has " << numSpaces << " words." << endl;
// reset word counter
numSpaces = 0;
cout << endl;
}
cout << "Total word count: " << wordTotal << endl;
// return 0
return 0;
}