Ask Question, Ask an Expert


Ask C/C++ Expert

Home >> C/C++

problem 1) prepare the program which compute the CRC-16 value for a given file and also verifies the correctness of a given file that already has CRC-16 value appended at the end, as more fully described below.

Use the CRC polynomial x^(16) + x^(11) + x^(8) + x^(7) + x^(3) + x^(2) + 1.

Program operation:

1) The program should compile from the command line.

2) The program executable file name must be “crcfile”.

3) The program should run from the command line and take two (2) command line parameters.

4) The first command line parameter would be a flag value which identifies the mode of operation: “c” for calculating a CRC value, or “v” for verifying a CRC value. Only these two values are allowed. Any other values must produce a simple error message and a graceful exit from the program.

5) The second command line parameter would be the name of the file to be examined. The file must be a text file that is in the same folder as the program executable. If the file is not found, the program must issue a simple error message and exit gracefully.

6) The program must direct all output to the command window (terminal) screen. The details of what to output are describeed below.
Specific Functions inside code:

You should implement the following functions/methods:

• A function/method for converting a hexadecimal string into binary string

• A function/method for converting a binary string to hexadecimal

• A function/method to validate the characters in the input file

• An XOR function/method that takes as input two binary strings and returns the XOR result.

• A function/method for CRC calculation

• A function/method for CRC verification

Input file format:

Create YOUR OWN VALID input file.

Valid input files would be text files which contain only hexadecimal characters. Either upper or lower case letters may appear, but they would only be letters which correspond to hexadecimal characters. There would be no whitespace, punctuation, or special characters in the input files.

You should check for input correctness by implementing code to verify that each character in the input file is a valid hexadecimal character (0,1,2,3,4,5,6,7,8,9A,B,C,D,E,F,a,b,c,d,e,f). Valid upper and lower case hex letters will be given the same meaning (“a” = “A” = 1010, etc.)
If an input file contains any invalid characters (other than an end-¬?of-¬?file marker), then the program should issue an appropriate brief error message and terminate gracefully.

Output format:

Print out the hexadecimal file that is read, 80 hex characters to a line.

Next, you should convert the hexadecimal file into binary. Recall that one hex character is four bits. Read the input file and form a binary string. The length of the binary string will be four times the length of the input file because each hexadecimal character will be replaced by 4 binary bits. You will have to define a separate function to get the binary equivalent of a hexadecimal character.

You must state how many zeroes are appended to the input. You must then print the binary version of the input file (after appending) 64 binary bits per line. You must also insert a space after every four binary bits that you print (increasing the line length to 80 characters).

Next, you will show the result of each XOR operation involved in the CRC calculation or verification. The result value at each step is a binary value that contains all of the digits of the dividend after an XOR operation.

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M94600

Have any Question? 

Related Questions in C/C++

Assignment simple 5-card poker gamein this assignment you

Assignment: Simple 5-Card Poker Game In this assignment, you will develop a simple poker game, complete with basic AI, using the object oriented programming principles discussed in class. Flow of Play Your poker game's p ...

A write an array implementation of self-adjusting lists in

a. Write an array implementation of self-adjusting lists. In a self-adjusting list, all insertions are performed at the front. A self-adjusting list adds a find operation, and when an element is accessed by a find, it is ...

Write a program that calculates mileage reimbursement for a

Write a program that calculates mileage reimbursement for a salesperson at a rate of $0.35 per mile. Your program should interact with the user in this manner: MILEAGE REIMBURSEMENT CALCULATOR Enter beginning odometer re ...

Pa 1 word countertabulating basic document statistics is an

PA #1: Word Counter Tabulating basic document statistics is an interesting exercise that leverages your knowledge of strings, files, loops, and arrays. In this homework, you must write a C++ program that asks the user fo ...

1 requirementsin this assignment you can unleash your

1. REQUIREMENTS In this assignment, you can unleash your imaginations and use OpenGL with C/C++ programming to produce a scene(s) that represents what you envision could possibly be seen under the sea. Please note that a ...

C program assignmentaccording to C Program Assignment According to

C Program Assignment According to, the great circle distance based on two coordinates in nautical miles is given by: d = r * Δσ where r is the radius of the earth and Δσ ...

Only one programwrite a c program to find fibonacci numbers

Only one program Write a C++ Program to Find Fibonacci Numbers using Dynamic Programming.

Discussion questonsplease respond to all of the following

Discussion Questons Please respond to all of the following prompts: • How are input and output accomplished in C++? • How do cin and cout relate to ostream and istream? Lab Activity 1. Write a C++ program per the require ...

For this program you will add and test 2 new member

For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, intpos) Assuming that the positions of elements of a list beg ...

Computer programming assignment-q1 using for loop write a c

Computer Programming Assignment- Q1. Using for loop, write a C++ program that prints out the multiples of 3 up through 75, separated by a blank space.  3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate