There is a problem in my textbook that I just can\'t get theright solution for.
ID: 3617118 • Letter: T
Question
There is a problem in my textbook that I just can't get theright solution for. It says: Write a looping code segment that takes as input up to 20integer scores from file indata, and outputs theiraverage. If the file contains fewer than 20 scores, the segmentshould still output the correct average. If the file contains morethan 20 scores, the additional numbers should be ignored. Be sureto consider what happens if the file is empty. There is a problem in my textbook that I just can't get theright solution for. It says: Write a looping code segment that takes as input up to 20integer scores from file indata, and outputs theiraverage. If the file contains fewer than 20 scores, the segmentshould still output the correct average. If the file contains morethan 20 scores, the additional numbers should be ignored. Be sureto consider what happens if the file is empty.Explanation / Answer
please rate - thanks #include #include using namespace std; int main() {int a,sum=0,i=0; ifstream in; ofstream out; in.open("indata.txt"); if(in.fail()) { coutRelated 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.