cout << "Please enter ...";
cin >> numStrings;
string* words = new ________[ ___ ];
for (int i = 0; i < __________; _______)
{
getline(cin, words[ ____ ] );
[add a period to the end of the word]
}
int total = ____;
for (int n = 0; n < __________; _______)
{
int count = ____;
while ( _________[ ][ ] != '.')
{
count++;
}
cout << ________[ ] << " has " << ________ << "letters\n";
total = total + _____________;
}
cout << "Total number of letters is " << _________ << endl;
#include <iostream>
#include <string>
using namespace std;
int main()
{
int numStrings;
cout << "Please enter ...";
cin >> numStrings;
fflush(stdin);
string* words = new string[numStrings];
for (int i = 0; i < numStrings; ++i)
{
getline(cin, words[i]);
fflush(stdin);
//[add a period to the end of the word]
}
int total = 0;
for (int n = 0; n < numStrings; ++n)
{
int count = 0;
while ( words[n][count] != '.')
{
count++;
}
cout << words[n] << " has " << count << " letters\n";
total = total + count;
}
cout << "Total number of letters is " << total << endl;
delete[] words;
return 0;
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
Adobe Flash