Software Development with C++ Lab Report Essays | Online Homework Help

Write a program to read data from an input file. The first value read is the number of numbers to be read next. Calculate the average of those numbers and display on screen and write to an output file the numbers read and the average of each group of numbers.

input file:

4 12 14 99 83 5 2 9 56 4 3 2 13 15 1 6 8 32 12 3 4 5 12 34 45 0

Implementation:

Use “input.dat” for input file name and “output.dat” for output file name.

Sample Output:

Read 4 numbers:
The numbers are: 12
14
99
83
The average = 52

Read 5 numbers:
The numbers are: 2
9
56
4
3
The average = 14.8

Read 2 numbers:
The numbers are: 13
15
The average = 14

Read 1 numbers:
The numbers are: 6
The average = 6

Read 8 numbers:
The numbers are: 32
12
3
4
5
12
34
45
The average = 18.375

———————————————————————————–

  • Point Distribution:
  • -50 Does not compile
  • -5 Warnings
  • -5 No description multiple line comments (name, date, etc)
  • -5 No single line comments (logic, input, output, etc)
  • -10 Incorrect file names.
  • -20 Incorrect values in the output file.

 

Calculate your paper price
Pages (550 words)
Approximate price: -