User Tools

Site Tools


haas:fall2019:discrete:projects:mtf1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
haas:fall2019:discrete:projects:mtf1 [2019/09/23 17:05] – [Objective] wedgehaas:fall2019:discrete:projects:mtf1 [2019/09/26 17:59] (current) wedge
Line 23: Line 23:
     * if it doesn't exist, default to multiplication     * if it doesn't exist, default to multiplication
     * if it exists and doesn't contain a valid symbol, display an error and exit     * if it exists and doesn't contain a valid symbol, display an error and exit
 +  * for some operations, the result violates the properties of mathematics. In the case of such invalid results, display "NA" instead of a number (within the same fixed/formatted spacing) 
 +  * for the non-associative operations, the variable driving the individual rows should be the one operated on (ie result = row - col)
 =====Program Output===== =====Program Output=====
 +
 +====Default, no options or settings alterations====
 <cli> <cli>
 lab46:~/src/discrete/mtf1$ ./mtf1 lab46:~/src/discrete/mtf1$ ./mtf1
-                       9  10  11  12 +             8   
-   x------------------------------------------------ +  [*]---------------------------  
- 1 |                    10  11  12 + 1 |          
- 2 |          10  12  14  16  18  20  22  24 + 2 |     8 10 12 14 16 18 
- 3 |       9  12  15  18  21  24  27  30  33  36 + 3 |   6  12 15 18 21 24 27 
- 4 |      12  16  20  24  28  32  36  40  44  48 + 4 |   8 12 16 20 24 28 32 36 
- 5 |    10  15  20  25  30  35  40  45  50  55  60 + 5 |  5 10 15 20 25 30 35 40 45 
- 6 |    12  18  24  30  36  42  48  54  60  66  72 + 6 |  6 12 18 24 30 36 42 48 54 
- 7 |    14  21  28  35  42  49  56  63  70  77  84 + 7 |  7 14 21 28 35 42 49 56 63 
- 8 |    16  24  32  40  48  56  64  72  80  88  96 + 8 |  8 16 24 32 40 48 56 64 72 
- 9 |   9  18  27  36  45  54  63  72  81  90  99 108 + 9 |  18 27 36 45 54 63 72 81
-10 |  10  20  30  40  50  60  70  80  90 100 110 120 +
-11 |  11  22  33  44  55  66  77  88  99 110 121 132 +
-12 |  12  24  36  48  60  72  84  96 108 120 132 144+
 </cli> </cli>
  
-I hope that renders correctly- note how everything is neatly aligned in its spaced column.+====Altering the operation to perform (addition)==== 
 +<cli> 
 +lab46:~/src/discrete/mtf1$ MTF1_OPER="+" ./mtf1 
 +      1  2  3  4  5  6  7  8  9  
 +  [+]---------------------------  
 + 1 |  2  3  4  5  6  7  8  9 10 
 + 2 |  3  4  5  6  7  8  9 10 11 
 + 3 |  4  5  6  7  8  9 10 11 12 
 + 4 |  5  6  7  8  9 10 11 12 13 
 + 5 |  6  7  8  9 10 11 12 13 14 
 + 6 |  7  8  9 10 11 12 13 14 15 
 + 7 |  8  9 10 11 12 13 14 15 16 
 + 8 |  9 10 11 12 13 14 15 16 17 
 + 9 | 10 11 12 13 14 15 16 17 18 
 +</cli>
  
-Altering the upper bound:+====Subtraction==== 
 +<cli> 
 +lab46:~/src/discrete/mtf1$ MTF1_OPER="-" ./mtf1 7 
 +      1  2  3  4  5  6  
 +  [-]------------------  
 + 1 |  0 -1 -2 -3 -4 -5 
 + 2 |  1  0 -1 -2 -3 -4 
 + 3 |  2  1  0 -1 -2 -3 
 + 4 |  3  2  1  0 -1 -2 
 + 5 |  4  3  2  1  0 -1 
 + 6 |  5  4  3  2  1  0 
 +</cli>
  
 +====Division====
 <cli> <cli>
-lab46:~/src/discrete/mtf0$ ./mtf0 6 +lab46:~/src/discrete/mtf1MTF1_OPER="/" ./mtf1 16 
-     1  2  3  4  5  6 +      1  2  3  4  5  6   8  9  A  B  C  D  E  F  
-  x------------------ +  [/]---------------------------------------------  
-1 |  1  2  3    6 + 1 |  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0 
-2 |  2    8 10 12 +  2  1  0  0  0  0  0  0  0  0  0  0  0  0  0 
-3 |  3   9 12 15 18 +    1  0  0  0  0  0  0  0  0  0  0  0  0 
-4 |  4  8 12 16 20 24 + 4 |  4    1  0  0  0  0  0  0  0  0  0  0  0 
-5 |  5 10 15 20 25 30 +   2    1  0  0  0  0  0  0  0  0  0  0 
-6 |  6 12 18 24 30 36+ 6 |  6    1  1  1  0  0  0  0  0  0  0  0  0 
 +   3   1  1  1  1  0  0  0  0  0  0  0  0 
 + 8 |  8    2  1  1  1  1  0  0  0  0  0  0  0 
 +   4  3  2  1  1  1  1  1  0  0  0  0  0  0 
 + A |  A    2  2  1  1  1  1  1  0  0  0  0  0 
 +     2  2  1  1  1  1  1  1  0  0  0  0 
 + C |  C    3  2  2  1  1  1  1  1  1  0  0  0 
 +     3  2  2  1  1  1  1  1  1  1  0  0 
 + E |  E  7  4  3  2  2  2  1  1  1  1  1  1  1  0 
 + F |  F  7  5  3  3  2  2  1  1  1  1  1  1  1  1
 </cli> </cli>
  
-Another variation (customizing the upper, lower bounds):+====Remainder==== 
 +<cli> 
 +lab46:~/src/discrete/mtf1$ MTF1_OPER="%" ./mtf1 9 
 +      1  2  3  4  5  6  7  8  
 +  [%]------------------------  
 + 1 |  0  1  1  1  1  1  1  1 
 + 2 |  0  0  2  2  2  2  2  2 
 + 3 |  0  1  0  3  3  3  3  3 
 + 4 |  0  0  1  0  4  4  4  4 
 + 5 |  0  1  2  1  0  5  5  5 
 + 6 |  0  0  0  2  1  0  6  6 
 + 7 |  0  1  1  3  2  1  0  7 
 + 8 |  0  0  2  0  3  2  1  0 
 +</cli> 
 +====Altering the base==== 
 +<cli> 
 +lab46:~/src/discrete/mtf1$ ./mtf1 8 
 +      1  2  3  4  5  6  7  
 +  [*]---------------------  
 + 1 |  1  2  3  4  5  6  7 
 + 2 |  2  4  6 10 12 14 16 
 + 3 |  3  6 11 14 17 22 25 
 + 4 |  4 10 14 20 24 30 34 
 + 5 |  5 12 17 24 31 36 43 
 + 6 |  6 14 22 30 36 44 52 
 + 7 |  7 16 25 34 43 52 61 
 +</cli>
  
 +====Altering the base, extending the upper bound====
 <cli> <cli>
-lab46:~/src/discrete/mtf0$ ./mtf0 7 4 +lab46:~/src/discrete/mtf1$ ./mtf1 12 13 
-        7 +                      8        10  11  
-  x------------ +   [*]----------------------------------------------------  
-4 | 16 20 24 28 +  1 |           5              10  11 
-5 | 20 25 30 35 +  2   2          10  12  14  16  18  1A  20  22 
-6 | 24 30 36 42 +  3 |        10  13  16  19  20  23  26  29  30  33 
-7 | 28 35 42 49+  4 |      10  14  18  20  24  28  30  34  38  40  44 
 +  5 |   5    13  18  21  26  2B  34  39  42  47  50  55 
 +  6 |   6  10  16  20  26  30  36  40  46  50  56  60  66 
 +  7 |   7  12  19  24  2B  36  41  48  53  5A  65  70  77 
 +  8 |    14  20  28  34  40  48  54  60  68  74  80  88 
 +  9 |    16  23  30  39  46  53  60  69  76  83  90  99 
 +  A |    18  26  34  42  50  5A  68  76  84  92  A0  AA 
 +  B |    1A  29  38  47  56  65  74  83  92  A1  B0  BB 
 + 10 |  10  20  30  40  50  60  70  80  90  A0  B0 100 110 
 + 11 |  11  22  33  44  55  66  77  88  99  AA  BB 110 121
 </cli> </cli>
  
-Spacing, formatting, and presentation are centrally important. I want those headers and headings, and dividing lines. Your output should match my output.+====All of that, plus lower bound==== 
 +<cli> 
 +lab46:~/src/discrete/mtf1$ ./mtf1 13 8 2 
 +      2  3  4  5  6  7  8  
 +  [*]---------------------  
 + 2 |  4  6  8  A  C 11 13 
 + 3 |  6  9  C 12 15 18 1B 
 + 4 |  8  C 13 17 1B 22 26 
 + 5 |  A 12 17 1C 24 29 31 
 + 6 |  C 15 1B 24 2A 33 39 
 + 7 | 11 18 22 29 33 3A 44 
 + 8 | 13 1B 26 31 39 44 4C 
 +</cli> 
 + 
 +Spacing, formatting, and presentation are centrally important. I want those headers and headings, and dividing lines. Your output should match my output (all to STDOUT).
  
 An issue you might run into is how much space will you have to allocate (you want it universal for the display of the entire table). For that, I say determine the length of the maximum value being output (ie the bottom-most right value). That value’s length should then influence all the other output in the table. An issue you might run into is how much space will you have to allocate (you want it universal for the display of the entire table). For that, I say determine the length of the maximum value being output (ie the bottom-most right value). That value’s length should then influence all the other output in the table.
 +
 +=====Submission=====
 +To successfully complete this project, the following criteria must be met:
 +
 +  * Code must compile cleanly (no warnings or errors)
 +    * Use the **-Wall** and **--std=gnu99** flags when compiling.
 +  * Code must be nicely and consistently indented (you may use the **indent** tool)
 +  * Code must utilize the algorithm/approach presented above
 +  * Output **must** match the specifications presented above (when given the same inputs)
 +  * Code must be commented
 +    * be sure your comments reflect the **how** and **why** of what you are doing, not merely the **what**.
 +  * Track/version the source code in a repository
 +  * Submit a copy of your source code to me using the **submit** tool.
 +
 +To submit this program to me using the **submit** tool, run the following command at your lab46 prompt:
 +
 +<cli>
 +$ submit discrete mtf1 mtf1.c
 +Submitting discrete project "mtf1":
 +    -> mtf1.c(OK)
 +
 +SUCCESSFULLY SUBMITTED
 +</cli>
 +
 +You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.
haas/fall2019/discrete/projects/mtf1.1569258302.txt.gz · Last modified: 2019/09/23 17:05 by wedge