Of course, some of the recorded
functions will very likely invoke others of these functions. It is decent
practice to reuse components instead of writing the same block of code in
multiple places. Many logical errors can be evaded by doing so, and if any
corrections are needed, they can be done conveniently in just one place.
Keep in mind that the basic
idea is to break down the overall task into small pieces that can be developed
(and tested) separately so you can build your program incrementally.
Program Output
The program must present
output consisting of header information, intermediate results, and final
results, as described separately below. Sample outputs follow in the next
section.
Header Information
The header information should
be written on distinct lines as shown in the sample outputs that follow. The
individual lines are:
1. The program must first
write a string of 62 hyphens (dashes) to serve as a separator, and then, 2
lines below it, the string "CIS3360 Fall 2017 Integrity Checking Using
CRC", and then on the next line the string "Author: " followed
by your name (or names, if teaming) and a newline.
2. The program must then
write the string "The input string (hex): ", followed by the string
value of the second command line input argument
3. The program must then
write the string "The input string (bin): ", followed by the binary
value of the second command line input argument, and then a newline.
4. The program must then
write the string "The polynomial that was used (binary bit string):
", followed by the 13-bit binary value of the polynomial given at the top
of this assignment with spaces every 4 characters to improve readability.
5. The program must then
write the string "Mode of operation: ", followed by either the word
"calculation" or "verification", depending on the value of
the first command line input argument
6. The content of this line
depends on whether the mode is calculate or verify.
a. If in calculation mode,
this line should read: "Number of zeroes that will be appended to the
binary input: 12"
b. If in verification mode,
this line should read: "The CRC observed at the end of the input: ",
followed by the binary and hex values for the last 3 hex characters of the
input string, as shown in the sample outputs that follow.
Intermediate Results
This section will begin with
the string: "The binary string difference after each XOR step of the CRC
calculation", followed by a newline.
Following the above
statement, this section will show on separate lines the results of each XOR
step as described above, with spaces every 4 characters as shown to improve
readability.
Note that for calculation
mode, you must pad the binary version of the input string with 12 zeroes before
you start the division procedure, but for confirmation mode you have two
choices. The first step is to remove the last three hex characters demonstrating
the observed CRC, in which case you must then pad the rest with 12 zeroes like
you were calculating the CRC. The second step is to leave the detected CRC
attached to the rest of the input, in which case you should not add zeroes for
padding. The difference between these two choices determines how you will
interpret the result in the bottom row of the intermediate results output.
<span> </span>