Answered step by step
Verified Expert Solution
Question
1 Approved Answer
help #include #include #include using namespace std; int main() { float num, average = 0, sum = 0; int cnt = 0; fstream inputfile, outputfile;
help
#includeHinclude#include #include using namespace std; int main() { float num, average = 0, sum = 0; int cnt = 0; fstream inputfile, outputfile; //a) Open the input file named "fileInp.txt" (2 marks) Answer; //b) Open the output file named "fileOut.txt" (2 marks) Answer; //c) Check for successful opening file (2 marks) if (Answer) { cout return 0; } //d) Read data from the input file (2 marks) while (Answer) { //e) Write data to the output file (2 marks) outputfile sum = Answer; cnt++; } //g) Calculate average (1 mark) average = Answer; //h) Display average to the output file (1 mark) outputfile Answer; //j) Close the output file (1 mark) Answer; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started