Procedures, Arrays and File Input
Proper use of procedures and parameters to create a well written modular program.
The operators DIV and MOD are now not required.
Again reals in the form of exponential notation need not be considered.
Operator precedence must now be taken into account as well as the bracketing of expressions.
Your program must use arrays as the main storage medium for the equation.
The complete arithmetic expression will be read from a file.
The file may contain a number of equations.
An equation will not cover more than one line and may be assumed to be entirely valid.
For example the file might contain the following:
4 + 2 * 5 + 2
56 - 12 / 3 + 1.1 * 5
The first equation will be completely evaluated and the final answer determined before the next equation is read and evaluated.
Everytime an intermediate result is calculated the corresponding components of that calculation are removed from the array(s) and replaced by the single answer. For example the second step for the first equation would have the equation stored as 4 + 10 + 2.
How hard is this to do?
Proper use of procedures and parameters to create a well written modular program.
The operators DIV and MOD are now not required.
Again reals in the form of exponential notation need not be considered.
Operator precedence must now be taken into account as well as the bracketing of expressions.
Your program must use arrays as the main storage medium for the equation.
The complete arithmetic expression will be read from a file.
The file may contain a number of equations.
An equation will not cover more than one line and may be assumed to be entirely valid.
For example the file might contain the following:
4 + 2 * 5 + 2
56 - 12 / 3 + 1.1 * 5
The first equation will be completely evaluated and the final answer determined before the next equation is read and evaluated.
Everytime an intermediate result is calculated the corresponding components of that calculation are removed from the array(s) and replaced by the single answer. For example the second step for the first equation would have the equation stored as 4 + 10 + 2.
How hard is this to do?
Comment