Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: Write a complete C++ program that fulfills the following requirements: 1. Allow the user to input a number of bits to represent a base

Instructions: Write a complete C++ program that fulfills the following requirements: 1. Allow the user to input a number of bits to represent a base 10 integer (in the Excess M system). 2. Input the base 10 integer. Use a loop that will continue to input numbers until the user inputs an integer that is in range (based on the number of bits). 3. Compute and output the equivalent Excess M binary number to the console screen. 4. Continue to run the program until the user decides that he wants to quit. The user should be allowed to make an indefinite number of conversions. I want you to explainimage text in transcribed the code as well.

ICS 2301 Excess M Converter Input a integer number: -3 Input a number of bits: 2 Instructions: Write a complete C++ program that fulfills the following requirements: 1. Allow the user to input a number of bits to represent a base 10 integer (in the Excess M system). 2. Input the base 10 integer. Use a loop that will continue to input numbers until the user inputs an integer that is in range (based on the number of bits). 3. Compute and output the equivalent Excess M binary number to the console screen. 4. Continue to run the program until the user decides that he wants to quit. The user should be allowed to make an indefinite number of conversions. The range is:-1 to 2 (inclusive). -3 is out of range Input a integer number: -3 Sample Run: Excess M Converter Program: Input a number of bits: 6 Input a integer number: 4 The range is: -31 to 32 (inclusive) -3 = 011100 Do you want to continue (Y/y)? n Input a number of bits: 1 The range is: 0 to 1 (inclusive) 4 is out of range Press any key to continue... *************************************** Input a integer number: 4 Input a number of bits: 4 The range is: -7 to 8 (inclusive) 4 = 1011 Do you want to continue (Y/y)? y ICS 2301 Excess M Converter Input a integer number: -3 Input a number of bits: 2 Instructions: Write a complete C++ program that fulfills the following requirements: 1. Allow the user to input a number of bits to represent a base 10 integer (in the Excess M system). 2. Input the base 10 integer. Use a loop that will continue to input numbers until the user inputs an integer that is in range (based on the number of bits). 3. Compute and output the equivalent Excess M binary number to the console screen. 4. Continue to run the program until the user decides that he wants to quit. The user should be allowed to make an indefinite number of conversions. The range is:-1 to 2 (inclusive). -3 is out of range Input a integer number: -3 Sample Run: Excess M Converter Program: Input a number of bits: 6 Input a integer number: 4 The range is: -31 to 32 (inclusive) -3 = 011100 Do you want to continue (Y/y)? n Input a number of bits: 1 The range is: 0 to 1 (inclusive) 4 is out of range Press any key to continue... *************************************** Input a integer number: 4 Input a number of bits: 4 The range is: -7 to 8 (inclusive) 4 = 1011 Do you want to continue (Y/y)? y

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

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions