Change the code segment below so that it stops reading eitherat the end of the f
ID: 3613105 • Letter: C
Question
Change the code segment below so that it stops reading eitherat the end of the file or after 10,000 characters have beeninput. charoneChar; inteCount; intcharCount; eCount = 0 textData >>oneChar; charCount =0; while(textData) { charCount++; if(oneChar == 'z') eCount++; textData>> oneChar; } cout <<"Percentage of letter 'z':" <<float(eCount) / charCount * 100; Change the code segment below so that it stops reading eitherat the end of the file or after 10,000 characters have beeninput. charoneChar; inteCount; intcharCount; eCount = 0 textData >>oneChar; charCount =0; while(textData) { charCount++; if(oneChar == 'z') eCount++; textData>> oneChar; } cout <<"Percentage of letter 'z':" <<float(eCount) / charCount * 100;Explanation / Answer
char oneChar; inteCount; intcharCount; eCount = 0 textData >>oneChar; charCount =0; while(textData&&charCount<10000) { charCount++; if(oneChar == 'z') eCount++; textData>> oneChar; } cout <<"Percentage of letter 'z':" <<float(eCount) / charCount * 100;Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.