User Tools

Site Tools


haas:spring2014:cprog:projects:multby11

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:spring2014:cprog:projects:multby11 [2014/01/17 07:45] – [Prerequisites] wedgehaas: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>
 +<WRAP><color red><fs 200%>Corning Community College</fs></color></WRAP>
 +<WRAP><fs 150%>CSCS1320 C/C++ Programming</fs></WRAP>
 +</WRAP>
 +
 +~~TOC~~
 +
 ======Project: MENTAL MATH (MULTIPLY BY 11)====== ======Project: MENTAL MATH (MULTIPLY BY 11)======
  
-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/Corequisites=====
 In addition to the new skills required on previous projects, to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved: In addition to the new skills required on previous projects, to successfully accomplish/perform this project, the listed resources/experiences need to be consulted/achieved:
  
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 the user for the number (which will be processed against 11)+  * obtain its input from the command-line (argument 1, which will be processed against 11) 
 +    * 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:~/src/cprog/multby11$ 
 +</cli>
 +
 +Second, a two digit value without argument:
 +
 +<cli>
 +lab46:~/src/cprog/multby11$ ./multby11
 +Enter value: 32
 +32 x 11 = 352
 +lab46:~/src/cprog/multby11$ 
 +</cli>
 +
 +Next, a one digit value with argument:
 +
 +<cli>
 +lab46:~/src/cprog/multby11$ ./multby11 7
 +7 x 11 = 77
 +lab46:~/src/cprog/multby11$ 
 +</cli>
 +
 +Finally, two digit value with argument:
 +
 +<cli>
 +lab46:~/src/cprog/multby11$ ./multby11 567
 +567 x 11 = 6237
 lab46:~/src/cprog/multby11$  lab46:~/src/cprog/multby11$ 
 </cli> </cli>
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, you may run the following (from anywhere on lab46): 
- 
-<cli> 
-lab46:~$ verify cprog multby11 
-multby11: submitted successfully 
-</cli> 
  
-Note if automated assessment is available for the project, you may actually see results in the output as well. 
haas/spring2014/cprog/projects/multby11.1389944750.txt.gz · Last modified: 2014/01/17 07:45 by wedge