Solved–Program 3– Solution

$35.00 $24.00

Write a program in VS C++ 2017 to convert a signed floating-point number to its binary equivalent using the 14-bit format shown in class. To make your life easier, your program should first read in the integral part (including the sign if negative) and the fractional part for the floating-point number to be converted. Your…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

Write a program in VS C++ 2017 to convert a signed floating-point number to its binary equivalent using the 14-bit format shown in class. To make your life easier, your program should first read in the integral part (including the sign if negative) and the fractional part for the floating-point number to be converted. Your program then does the necessary conversion and displays the result to the screen. The following shows a scenario of running a sample program, where user’s inputs are represented in boldface.

Enter the integral part of the floating-point number: –17

Enter the fractional part of the floating-point number: 23

The binary equivalent of the floating-point number is 11001100010011

More conversion (y or n): y

Enter the integral part of the floating-point number: 0

Enter the fractional part of the floating-point number: 03125

The binary equivalent of the floating-point number is 00101000000000

More conversion (y or n): n

Good bye!

Note that excess-15 should be used to produce a biased exponent for each of the floating-point numbers to be converted. Note also that the 0 in the fractional part of the second example shown above cannot be omitted.

Follow the criteria shown below to prepare and turn your program in to Canvas.

  1. You MUST use VS C++ 2017 to develop, compile, debug, test, and run your program.

  1. Submit only the source-code file to Canvas (on time or late).

  1. Make sure your program compiles successfully in order not to lose a major portion of total points.

  1. Your program will be tested using the test cases similar to those shown above.

Page 1 of 1