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

C++ programming I need help counting words and letters in a data file. Example P

ID: 3610691 • Letter: C

Question

C++ programming I need help counting words and letters in a data file. Example Program output Enter inputfile name data09 The reformatted content of data09 is: Jack and Jill went up the hIll 2 fetch a pail of
still water. Jack fell down and broke his crown
and Jill came tumbling after! willjillbeill? Words:   27 Letters:   111 data09 is a filestream. I need to add it to my program. This is my program sofar: #include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
ifstream infile; //input filestream variable
string FileName; //variable to hold file name
int count,prevcount=0,max=50;
string word;
bool notfirst=false,firstword=true;
cout<<"Enter input file name"<<endl;
cin>>FileName;
infile.open(FileName.c_str());
infile>>word;
while(infile)
    {count=word.length();
      if(count+prevcount>max)
        {cout<<endl;
         prevcount=0;
         notfirst=false;
        }
      else
        notfirst=true;
      prevcount+=count+1;
      if(notfirst&&!firstword)
        cout<<" ";
      firstword=false;
      cout<<word;
      infile>>word;
    }
cout<<endl;
return 0;
}
C++ programming I need help counting words and letters in a data file. Example Program output Enter inputfile name data09 The reformatted content of data09 is: Jack and Jill went up the hIll 2 fetch a pail of
still water. Jack fell down and broke his crown
and Jill came tumbling after! willjillbeill? Words:   27 Letters:   111 data09 is a filestream. I need to add it to my program. This is my program sofar: #include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
ifstream infile; //input filestream variable
string FileName; //variable to hold file name
int count,prevcount=0,max=50;
string word;
bool notfirst=false,firstword=true;
cout<<"Enter input file name"<<endl;
cin>>FileName;
infile.open(FileName.c_str());
infile>>word;
while(infile)
    {count=word.length();
      if(count+prevcount>max)
        {cout<<endl;
         prevcount=0;
         notfirst=false;
        }
      else
        notfirst=true;
      prevcount+=count+1;
      if(notfirst&&!firstword)
        cout<<" ";
      firstword=false;
      cout<<word;
      infile>>word;
    }
cout<<endl;
return 0;
}

Explanation / Answer

please rate - thanks has digits, consonants etc in it too #include #include #include #include using namespace std; int main() { ifstream infile; //input filestream variable string FileName; //variable to hold file name intcount,prevcount=0,max=50,cons=0,digit=0,sent=0,i,j,words=0,letters=0; string word; bool notfirst=false,firstword=true; char punct[]={'.','!','?'}; charconsti[]={'B','C','D','F','G','H','J','K','L','M','N','P',                'Q','R','S','T','V','W','X','Y','Z'}; coutword; while(infile)     {words++;     count=word.length();     for(i=0;i
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