Write a program that will read a series of lines

Assignment Help C/C++ Programming
Reference no: EM131891049

Programming Assignment

Write a program that will read a series of lines from an input file named hw8in.txt. Each line will contain 3 values:

A whole number
A numerator
A denominator

Collectively, these 3 values represent a floating point number. For example, a possible line of input might be:

3  3  4
This will become: 3.0 + 3.0 / 4.0 or 3.75

Your program will store this value in a float (Do NOT use double) and will display to the console, both its float and floating point binary values. Again using the above float from the input file, the output would be:

Floating point format of 3.750000000000000:
0  10000000  11100000000000000000000

Your program must create the same output as shown in the sample run that is included below. This includes breaking the 32 bits into 3 separate fields (sign, exponent, and fraction).

NOTE: Due to the input format of whole, numerator, denominator, you will need to use 0 1 for the last 2 digits if there is no fractional portion to the entire value to be evaluated. E.g. 5 0 1 will evaluate to 5.0.

Design your own input file (Hw8in.txt) and include as many variations of input as needed to fully test your program.

Write the entire program in one .c file (Hw8.c). Organize your solution into a sensible set of functions. As always, turning in code you may find on the internet is not acceptable. The goal of the assignment is for you to practice manipulating bits.

The float data type of C usually requires 32 bits (or 4 bytes). To ensure this is true for your machine, try this: printf("float size in bytes: %d", sizeof(float)); If the value printed out is not 4, please talk to me about how to do the assignment.

Attachment:- Input-file.rar

Reference no: EM131891049

Questions Cloud

Prepare a list of questions to conduct the interview : Read the complete description for the Final Paper in the Final Paper link. This paper will require you to select an interview subject.
Planning on retirement at age : Assume that you are 30 years old? today, and that you are planning on retirement at age 65. Your current salary is? $45,000 and you expect
Which project would be selected : Which project would be selected, assuming they are mutually exclusive, using each ranking method? Which should actually be selected. Show your work
What would be the present value : What would be the present value if the money is compounded monthly?
Write a program that will read a series of lines : Write a program that will read a series of lines from an input file named hw8in.txt. Design your own input file (Hw8in.txt) and include as many variations.
What is sylvester amti : Sylvester files as a single taxpayer during 2017 and claims one personal exemption. What is Sylvester's AMTI if he used the home-equity proceeds to purchase car
What is the most the company should invest today : If management wants to get a minimum of 6% per year rate of return out of this investment, what is the most the company should invest today
Use of game theory in business intelligence systems : Write a research paper around 7 pages on Use of Game Theory in Business Intelligence Systems.
Explain the most influential definition of health : The most influential definition of health as being "a state of complete physical, mental, and social well-being and not merely the absence of disease.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that will simulate a single game of craps

CSCI 240 - write a program that will simulate a single game of Craps and The program will use the random number generator to simulate the rolling of the die

  Consider the following einf gramar for the simple calculator

Consider the following EINF gramar for the simple calculator language mentioned in class.

  Floating point values into an array

Write a program that allows a user to enter 10 floating point values into an array. Then, in a loop, the program should prompt the user for a desired precision and subsequently display each value to the correct precision.

  Compute the squares of the numbers in the array

Write a java program to find the number in the given list. Write a java program to find the location of an element in the list.

  Simulates a simple contact manager application

Create a program that simulates a simple contact manager application - The program will then search for the name and print the name and the associated telephone

  Requirements given in the problem statement

Develop the code that meets the requirements given in the problem statement. Use the concept of access specifiers while developing the code.

  Design and implement a dynamic queue

Design and implement a dynamic queue - Allocate and de-allocate memory at runtime and Manipulate links in a dynamic queue

  Online shopping order and computes and outputs

Write a program that allows the user to input a total dollar amount for an online shopping order and computes and outputs the shipping cost based on the following schedule:

  Implement a class to represent a matrix

Implement a class to represent a matrix. While doing this exercise, you are allowed only to use C++ primitive types and arrays. You may not use STL in your Matrix definition. You must use dynamic memory.

  Write a java class named mylinkedlist and implement it

void updateList(MyLinkedList otherlist) that will update the current list with a given otherlist. If an element in current list exists in the otherlist then replace (update) it, otherwise insert (add) it using the above insertSortNoDuplicate metho..

  Size of an uncompressed text

Suppose the size of an uncompressed text file is 1 megabyte. How long does it take to download the file over a 32 Kilobit per second modem? How long does it take to take to download the file over a 1 megabit per second modem?

  Formulate an linear programming model

1. Formulate an Linear Programming model for this problem 2. Create a spreadsheet model for this problem and solve it using Solver 3. What is the optimal solution?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd