This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:fall2019:c4eng:projects:mtf1 [2019/09/23 12:49] – [Sample run with invalid operation given] wedge | haas:fall2019:c4eng:projects:mtf1 [2019/10/01 12:07] (current) – [Specifications] wedge | ||
---|---|---|---|
Line 13: | Line 13: | ||
=====Program===== | =====Program===== | ||
- | It is your task to enhance the program you wrote last week (**mtf0**) that will use loops and other programming concepts learned this far to automate the display of entire mathematical operation tables (addition, subtraction, | + | It is your task to enhance the program you wrote last week (**mtf0**) that will use loops and other programming concepts learned this far to automate the display of entire mathematical operation tables (addition, subtraction, |
+ | =====Specifications===== | ||
Your program should: | Your program should: | ||
+ | |||
* have valid, descriptive variable names of length //no shorter than// 4 symbols | * have valid, descriptive variable names of length //no shorter than// 4 symbols | ||
+ | * I will make an exception for the use of ' | ||
* prompt the user for the operation (' | * prompt the user for the operation (' | ||
* properly store this in a variable of type **char** | * properly store this in a variable of type **char** | ||
- | * check for a literal ' | + | * check for a literal ' |
- | * if invalid input, display an error and exit with a non-zero value | + | * if invalid input, display an error and exit with a non-zero value of 1 |
* prompt for the starting row (0-9) | * prompt for the starting row (0-9) | ||
* properly store this in a variable of type **unsigned char** | * properly store this in a variable of type **unsigned char** | ||
Line 30: | Line 33: | ||
* properly store this in a variable of type **unsigned char** | * properly store this in a variable of type **unsigned char** | ||
* check to make sure starting column, row is less than or equal to the corresponding ending column, row | * check to make sure starting column, row is less than or equal to the corresponding ending column, row | ||
- | * if not, display an error (to STDERR) and exit with non-zero status code | + | * if not, display an error (to STDERR) and exit with non-zero status code of 2 (for row) or 3 (for column) |
* display the table, performing the indicated operation | * display the table, performing the indicated operation | ||
* display both row and column headers, in uniform fashion/ | * display both row and column headers, in uniform fashion/ | ||
Line 41: | Line 44: | ||
* with certain (not all) operations on certain values, you might end up with a mathematically impossible result. In these cases, check for and avoid performing the computation, | * with certain (not all) operations on certain values, you might end up with a mathematically impossible result. In these cases, check for and avoid performing the computation, | ||
* Only the table (headers/ | * Only the table (headers/ | ||
+ | * For the math operations that are not associative, | ||
+ | * To display a ' | ||
+ | =====Compiling===== | ||
+ | As we have been doing all along, use the following options to gcc when compiling: | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
=====Execution===== | =====Execution===== | ||
====Sample run using multiplication==== | ====Sample run using multiplication==== | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
Which operation: * | Which operation: * | ||
Starting Row (0-9): 4 | Starting Row (0-9): 4 | ||
Line 149: | Line 162: | ||
</ | </ | ||
+ | |||
+ | =====Reference===== | ||
+ | In the C4ENG public directory, inside the **mtf1** subdirectory, | ||
=====Submission===== | =====Submission===== | ||
Line 181: | Line 197: | ||
*: | *: | ||
*: | *: | ||
- | *: | ||
*: | *: | ||
*:mtf1:no negative compiler messages for program [13/13] | *:mtf1:no negative compiler messages for program [13/13] |