Question: Using C + + , Write a program to ask user to enter 2 0 bytes of Hexadecimal number. Your program should have error checking
Using C Write a program to ask user to enter bytes of Hexadecimal number. Your program should have error checking for nonhexadecimal number, illegal version, and illegal header size. Extract the input and display the following information in decimal:
Version
Header Length how many bytes
Total Length how many bytes
The size of Data how many bytes
Protocol
Source IP address
Destination IP address
For Example: An IP datagram has arrived with the following information in the header in hexadecimal:
CEBEF
The answer should be
Version:
Header Length:
Total Length:
The size of Data:
Protocol:
Source IP address: C E
Destination IP address: BE F
HCEBEF
The answer should be
Error: illegal digit for hexadecimal
CEBEF
The answer should be
Error: Wrong version should be or
CEBEF
The answer should be
Error: Illegal header size
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
