This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:fall2019:discrete:projects:nbm0 [2019/09/09 13:20] – [Submission Criteria] wedge | haas:fall2019:discrete:projects:nbm0 [2019/09/09 13:23] (current) – [base conversion] wedge | ||
---|---|---|---|
Line 9: | Line 9: | ||
To apply your skills in crafting and deploying an algorithm that will enable you to convert a value from a source base to a destination base. | To apply your skills in crafting and deploying an algorithm that will enable you to convert a value from a source base to a destination base. | ||
- | =====base conversion===== | + | =====number bases===== |
Number representation, | Number representation, | ||
Line 33: | Line 33: | ||
* argv[3]: output base (represented from the point of view of base 10) | * argv[3]: output base (represented from the point of view of base 10) | ||
* base can be any from range of 2-36 (inclusive) | * base can be any from range of 2-36 (inclusive) | ||
- | * on invalid base (< 2 or > 36, display an error to STDERR and exit). | + | * on invalid base (< 2 or > 36, display an error to STDERR and exit with non-zero value). |
* converts those values into processable numeric values | * converts those values into processable numeric values | ||
* if input value contains invalid counting digits for base, display an error to STDERR and exit. | * if input value contains invalid counting digits for base, display an error to STDERR and exit. | ||
Line 39: | Line 39: | ||
* displays the output value to STDOUT, followed by a single newline. | * displays the output value to STDOUT, followed by a single newline. | ||
* Make sure your program ONLY displays the converted value to STDOUT- we will use this for output validation purposes. | * Make sure your program ONLY displays the converted value to STDOUT- we will use this for output validation purposes. | ||
- | * program then exits. | + | * program then exits, returning 0 on successful execution. |
+ | ====Restrictions==== | ||
Additional constraints: | Additional constraints: | ||
Line 50: | Line 51: | ||
* you may assume a MAXIMUM quantity of 2^64 (basically what can be stored in an **unsigned long long int**), aka 8 bytes for packed data, up to 64 bytes for per-digit binary values. | * you may assume a MAXIMUM quantity of 2^64 (basically what can be stored in an **unsigned long long int**), aka 8 bytes for packed data, up to 64 bytes for per-digit binary values. | ||
+ | =====Sample Output===== | ||
Sample output is as follows: | Sample output is as follows: | ||
Line 76: | Line 78: | ||
</ | </ | ||
=====Submission===== | =====Submission===== | ||
- | ====Project Submission==== | ||
- | To submit this program to me using the **submit** tool, run the following command at your lab46 prompt: | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | Submitting discrete project " | ||
- | -> nbm0.c(OK) | ||
- | |||
- | SUCCESSFULLY SUBMITTED | ||
- | </ | ||
- | |||
- | 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. | ||
=====Submission===== | =====Submission===== |