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

Need help with programming assignment Please show that program works Objective:

ID: 3693061 • Letter: N

Question

Need help with programming assignment

Please show that program works

Objective: Write a program that uses a loop. Use look for a sentinel to stop processing. Write a program that processes character data. An editor wants to check manuscripts for excessive punctuation. Write a program that will read data until it sees a # character, then print the number of characters read and the number that were punctuation (for this problem, any of the characters.,;: ! ?). If the punctuation exceeds 5% of the total, print a warning for the editor. NOTE: If you might start with a program that just counts the number of input characters, then add the count of the punctuation later. I will give 90% credit for a program that just counts the characters.

Explanation / Answer

#include<iostream>
using namespace std;
int main(){
int count=0,pcount=0;
float ppercent;
char ch;
cout<<"Enter text for processing, # for exit :"<<endl;
while(1){
cin>>ch;
if(ch == '#')
break;
count++;
if(ch=='.' || ch==',' || ch==';' || ch==':' || ch=='!' || ch == '?')
pcount++;
}
cout<<"number of characters : "<<count<<endl;
cout<<"number of punctuations : "<<pcount<<endl;
ppercent = pcount*100.0 / count;
cout<<"percentage of punctuation : "<<ppercent<<endl;
if(ppercent > 5)
cout<<"Warning !!! Excessive use of punctuations !!!!";
return 0;
}

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