a 2-D array image (Prompt)
I think my main problem is that I can not fully understand the prompt of the assigned program..
It says that I should choose a character such as '#' for the darkest character '0', and a blank for the brightest character, when reading a 2D array of numbers as every number represents brightness level '9'.. then what should we display for all the numbers between like '5' or '3' or '7' ??
Also I can not get the part about correcting errors because it is not explained enough..
That is the assigned problem Prompt, thank you.
Photos taken in space by the Galileo spacecraft are sent back to earth as a stream of numbers. each number represents a level of brightness. A large number represents a high brightness level, and a small number represents a low level. Your job is to take a matrix (a two-dimensional array) of the numbers and print it as a picture.
One approach to generating a picture is to print a dark character (such as #) when the brightness level is low, and to print a light character (such as a blank or a period) when the level is high. Unfortunately, errors in the transmission sometimes occur. Thus, your program should first attempt to find and correct these errors. Assume a value is in error if it differs by more than one from each of its four neighboring values, rounded to the nearest integer.
|4| 2 |5 |
The 2 would be regarded as an error and would be given a corrected value of 5
Note that values on the corners or boundaries of the matrix have to be processed differently than the values on the interior. your program should print an image of the uncorrected picture and then an image of the corrected picture.
Sample Input File: