Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Ok I need some help on building a program that is able to count the number of wo

ID: 441033 • Letter: O

Question

Ok I need some help on building a program that is able to count the number of words and sentence in a program. The current build I have is something amongst the line of

#include <iostream>

#include <string>

using namespace std;

int main()

{

string sentence

int wordcount;

int sentencecount;

while (cin >> sentence)

{

for(int i = 0; i < sentence.size(); i++)

{

if(sentence(i) == ' ')

{

wordcount++;


But from here, the program fails. So if possible, can someone write down the code to find word count and sentence count, using a style similar to the one I am providing?

Will rate upon the one that can complete this program similar to this fashion.


Explanation / Answer

#include #include using namespace std; int main() { int words,chars; string line; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote