This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:fall2019:c4eng:projects:cnv0 [2019/10/07 13:11] – [Verification] wedge | haas:fall2019:c4eng:projects:cnv0 [2019/10/07 18:14] (current) – [Specifications] wedge | ||
---|---|---|---|
Line 7: | Line 7: | ||
=====Objective===== | =====Objective===== | ||
- | To create a program that can calculate and determine the number of factor pairs of a given number, starting with values | + | To create a program that can calculate and determine the number of factor pairs of a given number, starting with values |
=====Reading===== | =====Reading===== | ||
Line 19: | Line 19: | ||
For 17, a prime number, we have just ONE factor pair: 1 and 17: | For 17, a prime number, we have just ONE factor pair: 1 and 17: | ||
- | 17 % 1 == 0 | + | * 17 % 1 == 0 |
- | 17 % 17 == 0 | + | |
All other values (2-16) when we divide them into 17 results in a non-zero value for the remainder. | All other values (2-16) when we divide them into 17 results in a non-zero value for the remainder. | ||
Line 50: | Line 50: | ||
The number 14: | The number 14: | ||
- | * 14 % 2 == 0 // | + | * 14 % 2 == 0 |
* 14 % 3 == 2 | * 14 % 3 == 2 | ||
* 14 % 4 == 2 | * 14 % 4 == 2 | ||
* 14 % 5 == 4 | * 14 % 5 == 4 | ||
* 14 % 6 == 2 | * 14 % 6 == 2 | ||
- | * 14 % 7 == 0 // | + | * 14 % 7 == 0 |
* 14 % 8 == 6 | * 14 % 8 == 6 | ||
* 14 % 9 == 5 | * 14 % 9 == 5 | ||
Line 97: | Line 97: | ||
* all code within the same scope aligned to its indentation level | * all code within the same scope aligned to its indentation level | ||
* have proximal comments explaining your rationale and what is going on, throughout your code | * have proximal comments explaining your rationale and what is going on, throughout your code | ||
- | * to STDERR, prompt for the number (range appropriate of a signed | + | * to STDERR, prompt for the number (range appropriate of an unsigned |
* properly store this in a variable of type **unsigned long int** | * properly store this in a variable of type **unsigned long int** | ||
* immediately after the input, check to make sure the input number is a positive number greater than or equal to 2; if in violation, display an error (to STDERR) and exit with a non-zero value. | * immediately after the input, check to make sure the input number is a positive number greater than or equal to 2; if in violation, display an error (to STDERR) and exit with a non-zero value. | ||
Line 140: | Line 140: | ||
The execution of the program is short and simple- obtain the input, do the processing, produce the output, and then terminate. | The execution of the program is short and simple- obtain the input, do the processing, produce the output, and then terminate. | ||
+ | |||
+ | =====Compiling===== | ||
+ | As we have been doing all along, use the following options to gcc when compiling: | ||
+ | |||
+ | <cli> | ||
+ | lab46: | ||
+ | lab46: | ||
+ | </ | ||
=====Reference===== | =====Reference===== | ||
In the C4ENG public directory, inside the **cnv0** subdirectory, | In the C4ENG public directory, inside the **cnv0** subdirectory, | ||
+ | <cli> | ||
+ | lab46: | ||
+ | Enter a number: 6 | ||
+ | 6 is a secondary number | ||
+ | lab46: | ||
+ | </ | ||
=====Verification===== | =====Verification===== | ||
In addition, I have also placed a **cnv0verify** script in that same subdirectory, | In addition, I have also placed a **cnv0verify** script in that same subdirectory, | ||
Line 172: | Line 186: | ||
To successfully complete this project, the following criteria must be met: | To successfully complete this project, the following criteria must be met: | ||
- | * Code must compile cleanly (no warnings | + | * Code must compile cleanly (no notes, |
* 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 | * Code must be nicely and consistently indented |