63 169
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #47042 in Action Script | Flash | Flex | ColdFusion for kanku

Question #47042
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;


Expert's answer
#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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions