This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:spring2015:cprog:projects:cbf0 [2015/03/22 13:27] – wedge | haas:spring2015:cprog:projects:cbf0 [2015/03/22 15:15] (current) – [Program] wedge | ||
---|---|---|---|
Line 56: | Line 56: | ||
If you are successful, the image should render itself in the browser, and you should be able to recognize it (vs. it being unreadable and unrecognizable). The image is intended to be meme-like in original, and hopefully will invoke a mild sense of humor (that of course is optional). | If you are successful, the image should render itself in the browser, and you should be able to recognize it (vs. it being unreadable and unrecognizable). The image is intended to be meme-like in original, and hopefully will invoke a mild sense of humor (that of course is optional). | ||
- | =====Program===== | ||
- | It is your task to write a program that obtains a long integer value from the user, and processes that single value into separate array elements (one digit per array element). Determining the number of digits, you are to perform this "all from nine, last from ten" subtraction method on the number using array transactions, | ||
- | |||
- | Your program should: | ||
- | * obtain its input from STDIN. | ||
- | * input should be in the form of a single (long) long integer value (you want a 64-bit data type) | ||
- | * determine the number of digits of the inputted value (store this in a variable) | ||
- | * process that input long integer into separate array elements- one digit per element. | ||
- | * you may assume a maximum array size of the maximum number of digits you're theoretically able to input that can be stored in a 64-bit value. | ||
- | * perform the "all from nine, the last from ten" operation on the array, storing the result in another array. | ||
- | * display the problem being solved, along with the answer | ||
- | * use functions to modularize your code: | ||
- | * have an **longint2array()** function that takes the long int, and returns an array (the function itself handles the processing of splitting up the long int into individual digits). | ||
- | * have a **printarray()** function, whose responsibility it is to display the indicated array to STDOUT. | ||
- | * have a **allfromnine()** function that takes the source array, does the processing, and returns ther result array. | ||
=====Submission===== | =====Submission===== | ||
Line 76: | Line 61: | ||
* Code must compile cleanly (no warnings or errors) | * Code must compile cleanly (no warnings or errors) | ||
- | * Output | + | * Final image must be viewable. |
* 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 | + | * Code must utilize the specifications |
* 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 84: | Line 69: | ||
* Track/ | * Track/ | ||
* Submit a copy of your source code to me using the **submit** tool. | * Submit a copy of your source code to me using the **submit** tool. | ||
+ | * You are to submit 3 files: | ||
+ | * your C source code to accomplish this task | ||
+ | * your copy of out.file | ||
+ | * your processed cbf0.jpg file | ||
To submit this program to me using the **submit** tool, run the following command at your lab46 prompt: | To submit this program to me using the **submit** tool, run the following command at your lab46 prompt: | ||
<cli> | <cli> | ||
- | $ submit cprog cbf0 cbf0.c | + | $ submit cprog cbf0 cbf0.c |
- | Submitting cprog project "afn0": | + | Submitting cprog project "cbf0": |
- | -> afn0.c(OK) | + | -> cbf0.c(OK) |
+ | -> out.file(OK) | ||
+ | -> / | ||
SUCCESSFULLY SUBMITTED | SUCCESSFULLY SUBMITTED |