Write a C++ program for the conversion of a decimal number to a binary, octal and hexadecimal equivalents within a given range of the upper and lower limits. Your program needs to follow the following steps to give the desired output. (1.a). Your program should ask to choose the upper limit from 256, 128, 32, 16, 8, 4, 2 only. If a user enters a number other than these numbers, the program should display a message of wrong entry and should ask for retry, otherwise continue to step (b). (1.b). Your program should ask to enter the lower limit. The lower limit should be less than the upper limit (of step 1.a) and greater than 0. If a user enters a number greater than the upper limit or less than 0 (e.g., a negative value), then the program should display a message of wrong entry and should ask for retry, otherwise continue to display the output. (1.c). If a user enters the upper and lower limits correctly, then the program should print a table of the binary, octal and hexadecimal equivalents of the given decimal numbers in the range of upper and lower limits as given in screenshots. Use of while loop, if else, for loop, nested loops is allowed. Functions, arrays and goto statements are NOT allowed.
Write a C++
equivalents within a given range of the upper and lower limits. Your program needs to follow the
following steps to give the desired output.
(1.a). Your program should ask to choose the upper limit from 256, 128, 32, 16, 8, 4, 2 only. If a
user enters a number other than these numbers, the program should display a message of wrong
entry and should ask for retry, otherwise continue to step (b).
(1.b). Your program should ask to enter the lower limit. The lower limit should be less than the
upper limit (of step 1.a) and greater than 0. If a user enters a number greater than the upper limit
or less than 0 (e.g., a negative value), then the program should display a message of wrong entry
and should ask for retry, otherwise continue to display the output.
(1.c). If a user enters the upper and lower limits correctly, then the program should print a table of
the binary, octal and hexadecimal equivalents of the given decimal numbers in the range of upper
and lower limits as given in screenshots.
Use of while loop, if else, for loop, nested loops is allowed. Functions, arrays and goto statements are NOT allowed.
![24
011000
30
18
25
011001
31
19
26
011010
32
la
27
011011
33
lb
le
1d
28
011100
34
29
011101
35
30
011110
36
le
31
011111
37
If
32
100000
40
20](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcdb36e49-f516-4fd3-bef6-71da97470173%2Fa02a2fe2-c4fc-4f2b-9b7e-6db48fd91a6e%2Fy69sjl9_processed.png&w=3840&q=75)
![Example output:
Please enter one of a number from this list (256, 128, 64, 32, 16, 8, 4 or 2) as upper limit: 45
You should enter the upper limit from this list only: 256, 128, 64, 32, 16, 8, 4, 2
Please enter the upper limit: 32
Enter lower limit: -12
You should enter the value greater than 0 and less than the upper limit
Enter lower limit: 50
You should enter the value greater than 0 and less than the upper limit
Enter lower limit: 10
Decimal
Binary
Octal
Hexadecimal
10
001010
12
a
11
001011
13
b
12
001100
14
13
001101
15
d
14
001110
16
15
001111
17
f
16
010000
20
10
17
010001
21
11
18
010010
22
12
19
010011
23
13
20
21
010100
24
14
25
26
010101
15
22
010110
16
23
010111
27
17](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcdb36e49-f516-4fd3-bef6-71da97470173%2Fa02a2fe2-c4fc-4f2b-9b7e-6db48fd91a6e%2Fnq9un0q_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)