Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C + + , Write a program to ask user to enter 2 0 bytes of Hexadecimal number. - Your program should run multiple

Using C++,Write a program to ask user to enter 20 bytes of Hexadecimal number. - Your program should run multiple time.
- Your program should have error checking for non-hexadecimal number, illegal version, and illegal header size. Extract the input and display the following information in decimal:
1. Version
2. Header Length (how many bytes)
3. Total Length (how many bytes)
4. The size of Data (how many bytes)
5. Protocol
6. Source IP address
7. Destination IP address
For Example: An IP datagram has arrived with the following information in the header (in hexadecimal):
4500005400030000200600007C4E0302B40E0F02
The answer should be
Version: 4
Header Length: 20
Total Length: 84
The size of Data: 64
Protocol: 6
Source IP address: 124.78.3.2(7C 4E 0302)
Destination IP address: 180.14.15.2(B40E 0F 02)
45H1005400030000200600007C4E0302B40E0F02
The answer should be
Error: illegal digit for hexadecimal
3500005400030000200600007C4E0302B40E0F02
The answer should be
Error: Wrong version (should be 4 or 6)
4400005400030000200600007C4E0302B40E0F02
The answer should be
Error: Illegal header size

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Question in Chemical Engineering Please give Correct Answer 2 1 .

Answered: 1 week ago

Question

Does it have at least one-inch margins?

Answered: 1 week ago

Question

Does it highlight your accomplishments rather than your duties?

Answered: 1 week ago