Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started