Process Control -- Problem G (15 points)
Monitoring does not start until 6 temperature values have been read. After the first 6 values have been read, the process must stop if the value of the current reading is outside the range of the moving average (the average of the previous six values) plus or minus 15%, or if two consecutive values are outside the range of moving average plus or minus 10% and on the same side. Read in a file containing one value per line and report at which reading the process needs to be stopped.
Input will be from a file PROBLEMG.DAT which contains more than 6 lines, each line containing one decimal number with at most one decimal place. There is always a stopping condition before the end of the file. There will be no more than 1000 numbers on the file.
Output, which must be written to standard output (the screen), will be the message "Process is halted after reading number N", where N is the line number of the last line read. There must be one blank between the word "number" and the number N.
12 14 13.5 14 13 12.8 13.2 14.5 17.3 15.2 16.8
Process is halted after reading number 9