haas/spring2026/cprog/projects/cnv0.md
... ...
@@ -0,0 +1,168 @@
1
+# CSCS1320 C/C++ Programming
2
+
3
+# PROJECT: CALCULATING N-ARY VALUES (cnv0)
4
+
5
+## OBJECTIVE
6
+
7
+To create a program that can calculate and determine the number of factor
8
+pairs of a given number, starting with values composed of exactly 2 sets
9
+of factor pairs.
10
+
11
+## GRABIT
12
+
13
+To assist with consistency across all implementations, data files for use
14
+with this project are available on lab46 via the **grabit** tool. Be sure
15
+to obtain it and ensure your implementation properly works with the
16
+provided data.
17
+
18
+```
19
+lab46:~/src/SEMESTER/cprog$ grabit cprog PROJECT
20
+```
21
+
22
+## PROGRAM
23
+
24
+It is your task to write a program that, upon accepting various pieces of
25
+input from the user, computes the number of factor pairs of a given
26
+number, displaying its eligibility as a secondary number.
27
+
28
+## SPECIFICATIONS
29
+
30
+Your program should:
31
+
32
+ * have valid, descriptive variable names of length *no shorter than* 4 symbols
33
+ * have consistent, well-defined indentation (no less than 4 spaces per level of indentation)
34
+ * all code within the same scope aligned to its indentation level
35
+ * have proximal comments explaining your rationale (the why and how), throughout your code
36
+ * to STDERR, prompt for the number (range appropriate of an unsigned long int)
37
+ * properly store this in a variable of type **unsigned long int**
38
+ * 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.
39
+ * proceed to evaluate the input number, determining whether or not it is a secondary (nary(2)) number.
40
+ * if it is, display to STDOUT that it is a secondary number (see execution section below for message)
41
+ * if it is not, display to STDOUT that it is not a secondary number (again, see execution section below)
42
+ * using a single return statement at the conclusion of the code, return a 0 indicating successful operation
43
+
44
+Some additional points of consideration:
45
+
46
+ * Note that the driving variables in your loops need to be at least of type **short int**, otherwise you may get a warning when you compile it.
47
+
48
+## PROCESS
49
+
50
+In general, you will be looking to do something like the following:
51
+
52
+```
53
+DISPLAY PROMPT
54
+READ NUMBER
55
+
56
+SHOULD NUMBER BE LOWER THAN TWO:
57
+ DISPLAY AN ERROR
58
+ EXIT WITH A NON-ZERO STATUS
59
+
60
+SO LONG AS FACTOR IS LESS THAN NUMBER:
61
+ SHOULD THE FACTOR BE A LEGITIMATE FACTOR OF NUMBER:
62
+ INCREMENT COUNT OF FACTOR PAIRS
63
+ SHOULD THIS NUMBER HAVE A SQUARE FACTOR:
64
+ INCREMENT COUNT OF FACTOR PAIRS
65
+
66
+SHOULD THE NUMBER OF FACTOR PAIRS MATCH WHAT WE ARE LOOKING FOR:
67
+ DISPLAY THAT NUMBER BEING PROCESSED IS OF THE NEEDED TYPE
68
+OTHERWISE:
69
+ DISPLAY THAT THE NUMBER BEING PROCESSED IS NOT THE NEEDED TYPE
70
+```
71
+
72
+## REFERENCE
73
+
74
+Copied as part of the grabit, inside your **cnv0/** subdirectory, will
75
+be a copy of my implementation (in executable form, by the name
76
+**ref_cnv0**), which abides by the project specifications. Please compare
77
+its output against that of your implementation. You can invoke the
78
+reference implementation by running the following:
79
+
80
+```
81
+yoursystem:~/src/SEMESTER/cprog/cnv0$ make check
82
+Enter a number: 6
83
+6 is a secondary number
84
+yoursystem:~/src/SEMESTER/cprog/cnv0$
85
+```
86
+
87
+## VERIFICATION
88
+
89
+In addition, I have also placed a **cnv0verify** script in that same
90
+subdirectory, which will test your program against a range of values, to
91
+determine overall correctness. You can run the verify script using the
92
+Makefile, as follows:
93
+
94
+```
95
+yoursystem:~/src/SEMESTER/cprog/cnv0$ make verify
96
+[ 1] you have: err, should be: err [ 2] you have: no, should be: no
97
+[ 3] you have: no, should be: no [ 4] you have: yes, should be: yes
98
+[ 5] you have: no, should be: no [ 6] you have: yes, should be: yes
99
+[ 7] you have: no, should be: no [ 8] you have: yes, should be: yes
100
+[ 9] you have: yes, should be: yes [ 10] you have: yes, should be: yes
101
+[ 11] you have: no, should be: no [ 12] you have: no, should be: no
102
+[ 13] you have: no, should be: no [ 14] you have: yes, should be: yes
103
+[ 15] you have: yes, should be: yes [ 16] you have: no, should be: no
104
+[ 17] you have: no, should be: no [ 18] you have: no, should be: no
105
+[ 19] you have: no, should be: no [ 20] you have: no, should be: no
106
+[ 21] you have: yes, should be: yes [ 22] you have: yes, should be: yes
107
+[ 23] you have: no, should be: no [ 24] you have: no, should be: no
108
+[ 25] you have: yes, should be: yes [ 26] you have: yes, should be: yes
109
+[ 27] you have: yes, should be: yes [ 28] you have: no, should be: no
110
+[ 29] you have: no, should be: no [ 30] you have: no, should be: no
111
+[ 31] you have: no, should be: no [ 32] you have: no, should be: no
112
+[ 33] you have: yes, should be: yes [ 34] you have: yes, should be: yes
113
+[ 35] you have: yes, should be: yes [ 36] you have: no, should be: no
114
+yoursystem:~/src/SEMESTER/cprog/cnv0$
115
+```
116
+
117
+## SUBMISSION
118
+
119
+To successfully complete this project, the following criteria must be
120
+met:
121
+
122
+ * Code must compile cleanly (no notes, warnings, nor errors)
123
+ * Output must be correct, and match the form given in the sample output above.
124
+ * Code must be nicely and consistently indented
125
+ * Code must be well commented
126
+ * Do NOT double space your code. Group like statements together.
127
+ * Output Formatting (including spacing) of program must conform to the provided output (see above).
128
+ * Track/version the source code in your private semester repository
129
+ * Submit a copy of your source code to me using the **submit** tool.
130
+
131
+### SUBMIT TOOL USAGE
132
+
133
+To submit this program to me using the **submit** tool, run the following
134
+command at your lab46 prompt:
135
+
136
+```
137
+lab46:~/src/SEMESTER/cprog/cnv0$ make submit
138
+```
139
+
140
+And make sure you get no error messages.
141
+
142
+You should get some sort of confirmation indicating successful submission
143
+if all went according to plan. If not, check for typos and or locational
144
+mismatches.
145
+
146
+### RUBRIC
147
+
148
+I'll be evaluating the project based on the following criteria:
149
+
150
+```
151
+182:cnv0:final tally of results (182/182)
152
+*:cnv0:resources obtained via grabit by Sunday before deadline [13/13]
153
+*:cnv0:proper error checking and status reporting performed [26/26]
154
+*:cnv0:correct variable types and name lengths used [13/13]
155
+*:cnv0:proper output formatting per specifications [26/26]
156
+*:cnv0:proper selection logic applied to perform comparisions [26/26]
157
+*:cnv0:proper iteration logic applied to carry out process [26/26]
158
+*:cnv0:runtime verify tests of submission succeed [26/26]
159
+*:cnv0:no negative compiler messages for program [13/13]
160
+*:cnv0:code is pushed to private semester repository [13/13]
161
+```
162
+
163
+Additionally:
164
+
165
+ * Solutions not abiding by spirit of project will be subject to a 50% overall deduction
166
+ * Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
167
+ * Solutions not utilizing indentation to promote scope and clarity or otherwise maintaining consistency in code style and presentation will be subject to a 25% overall deduction
168
+ * Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction