This is the latest version of all my programs so far.
This commit is contained in:
parent
631aa69e32
commit
28e820292f
6 changed files with 299 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue