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

I need help to complet this program: while-loop: end of file controlled while As

ID: 3617603 • Letter: I

Question

I need help to complet this program: while-loop: end of file controlled while
Assuming an input file stream, myIn, has been openedsuccessfully,
  • Use the while loop to read all the numbers stored in file.
  • After reading all the numbers, compute and print theiraverage.
  • Do not use an array.
  • It is possible that the file is empty, in which case theaverage is considered to be zero.
Examples:
If the file contains 1, 2, 3, and 4, your algorithm should print2.5.
If the file contains 1, 2, and 3, your algorithm should print2.
If the file contains nothing, your algorithm should print0. use the following variables(myIn, average,count, number, sum) I need help to complet this program: while-loop: end of file controlled while
Assuming an input file stream, myIn, has been openedsuccessfully,
  • Use the while loop to read all the numbers stored in file.
  • After reading all the numbers, compute and print theiraverage.
  • Do not use an array.
  • It is possible that the file is empty, in which case theaverage is considered to be zero.
Examples:
If the file contains 1, 2, 3, and 4, your algorithm should print2.5.
If the file contains 1, 2, and 3, your algorithm should print2.
If the file contains nothing, your algorithm should print0. use the following variables(myIn, average,count, number, sum)

Explanation / Answer

please rate - thanks #include #include using namespace std;    int main()    {double average;    int count=0,number, sum=0;    char filename[30];    coutfilename;    ifstream myIn;     myIn.open(filename);    if(myIn.fail())            //is it ok?        { 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