User Tools

Site Tools


haas:fall2019:c4eng:projects:cnv0

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:fall2019:c4eng:projects:cnv0 [2019/10/07 13:11] – [Verification] wedgehaas: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 with exactly 2 sets of factor pairs.+To create a program that can calculate and determine the number of factor pairs of a given number, starting with values composed of exactly 2 sets of factor pairs.
  
 =====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+  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  // another factor!+  * 14 % 2 == 0   another factor!
   * 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  // another factor!+  * 14 % 7 == 0   another factor!
   * 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 long int)+  * to STDERR, prompt for the number (range appropriate of an unsigned long int)
     * 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:~/src/c4eng/cnv0$ gcc -Wall --std=gnu99 -o cnv0 cnv0.c
 +lab46:~/src/c4eng/cnv0$ 
 +</cli>
  
 =====Reference===== =====Reference=====
 In the C4ENG public directory, inside the **cnv0** subdirectory, will be a copy of my implementation (in executable form, by the name **ref_cnv0**), which abides by the project specifications. Please compare its output against that of your implementation. In the C4ENG public directory, inside the **cnv0** subdirectory, will be a copy of my implementation (in executable form, by the name **ref_cnv0**), which abides by the project specifications. Please compare its output against that of your implementation.
  
 +<cli>
 +lab46:~/src/c4eng/cnv0$ /var/public/fall2019/c4eng/cnv0/ref_cnv0
 +Enter a number: 6
 +6 is a secondary number
 +lab46:~/src/c4eng/cnv0$ 
 +</cli>
 =====Verification===== =====Verification=====
 In addition, I have also placed a **cnv0verify** script in that same subdirectory, which will test your program against a range of values, to determine overall correctness. In addition, I have also placed a **cnv0verify** script in that same subdirectory, which will test your program against a range of values, to determine overall correctness.
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 or errors)+  * Code must compile cleanly (no notes, warnings, nor errors)
   * 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
haas/fall2019/c4eng/projects/cnv0.1570453897.txt.gz · Last modified: 2019/10/07 13:11 by wedge