This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:spring2014:cprog:projects:multby11 [2014/01/17 07:45] – [Prerequisites] wedge | haas:spring2014:cprog:projects:multby11 [2014/02/06 17:47] (current) – [Multiplying any single digit number by 11] wedge | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <WRAP centeralign round box> | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | ~~TOC~~ | ||
+ | |||
======Project: | ======Project: | ||
- | A project for C/C++ Programming. | ||
=====Objective===== | =====Objective===== | ||
To implement a programmatic solution (ie simulation) of a real life process- the mental math trick of multiplying any one-, two-, or three-digit number by eleven. | To implement a programmatic solution (ie simulation) of a real life process- the mental math trick of multiplying any one-, two-, or three-digit number by eleven. | ||
- | =====Prerequisites===== | + | =====Prerequisites/ |
In addition to the new skills required on previous projects, to successfully accomplish/ | In addition to the new skills required on previous projects, to successfully accomplish/ | ||
Line 25: | Line 31: | ||
In the case of 1 x 11, we get: 11 | In the case of 1 x 11, we get: 11 | ||
+ | |||
For 2 x 11, we see: 22 | For 2 x 11, we see: 22 | ||
+ | |||
For 3 x 11, we have: 33 | For 3 x 11, we have: 33 | ||
Line 162: | Line 170: | ||
Your program should: | Your program should: | ||
- | * prompt | + | * obtain its input from the command-line |
+ | * if there is no first argument, fall back to asking the user for input | ||
* determine from the input if it is a one-, two-, or three-digit number | * determine from the input if it is a one-, two-, or three-digit number | ||
* perform the correct algorithm against the input | * perform the correct algorithm against the input | ||
Line 169: | Line 178: | ||
=====Execution===== | =====Execution===== | ||
+ | Several operating behaviors are shown, namely, with and without command-line arguments and 1-, 2-, and 3-digit values. | ||
+ | |||
+ | First up, three digit value without argument: | ||
<cli> | <cli> | ||
Line 174: | Line 186: | ||
Enter value: 345 | Enter value: 345 | ||
345 x 11 = 3795 | 345 x 11 = 3795 | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | Second, a two digit value without argument: | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | Enter value: 32 | ||
+ | 32 x 11 = 352 | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | Next, a one digit value with argument: | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | 7 x 11 = 77 | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | Finally, two digit value with argument: | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | 567 x 11 = 6237 | ||
lab46: | lab46: | ||
</ | </ | ||
Line 189: | Line 226: | ||
* Code must compile cleanly (no warnings or errors) | * Code must compile cleanly (no warnings or errors) | ||
- | * Executed program must display a total of 2 lines, one for input, one for output. | + | * Executed program must display a total of 1 or 2 lines (depending on presence of argument) |
* Output must be correct, and match the form given in the sample output above. | * Output must be correct, and match the form given in the sample output above. | ||
* Code must be nicely and consistently indented (you may use the **indent** tool) | * Code must be nicely and consistently indented (you may use the **indent** tool) | ||
+ | * Code must utilize the algorithm presented above | ||
* Code must be commented | * Code must be commented | ||
* have a properly filled-out comment banner at the top | * have a properly filled-out comment banner at the top | ||
Line 210: | Line 248: | ||
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. | 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. | ||
- | ====Verify submission==== | ||
- | To verify you submitted successfully, | ||
- | |||
- | <cli> | ||
- | lab46:~$ verify cprog multby11 | ||
- | multby11: submitted successfully | ||
- | </ | ||
- | Note if automated assessment is available for the project, you may actually see results in the output as well. |