Program program that converts eight (8) bit binary numbers

Assignment Help Computer Engineering
Reference no: EM1332044

Write a C++ program that converts eight (8) bit binary numbers to their decimal equivalents. The program should retrieve the binary numbers (one at a time) from a data file (use a long int for the variable that represents the binary number).

For each binary number, convert the number to decimal one bit at a time (or all at once depending on your algorithm). The program will read the binary number (eight binary digits on one line with no spaces between them), convert the number, then go back to the data file to retrieve the next number. The number will have leading 0's if the binary number is smaller than eight digits. For example, the binary number could be 00001100 which would make the result decimal number 12. Or the number could be 10000001 and would result in decimal number 129. Note that the first example number had leading 0's.

The name of the input data file should be "binary.dat". For testing purposes, you will need to create this file and add some valid (and invalid, if any) binary numbers using the criteria described below.

For 5 extra credit points, you should make sure that the binary number only has 0's or 1's and your program should go on to the next number if not. However, you can always assume that the user will always enter eight digits (no more, no less.)

This program could have multiple solutions. The conversion of binary numbers to decimal numbers will be explained in class. However, you can look up conversions on the Internet for more examples. You may (although it isn't the only solution) need to use a combination of the modulus and division operators. It is advisable to plan out the solution to this problem well in advance of coding the program.

You will need to use a for() loop to process the eight bits. You will need to use a while() loop to access the numbers in the data file (checking for the end of file). This program will help you read data from a data file, valid the data and process correct numbers.

Reference no: EM1332044

Questions Cloud

Private-sector making public commitment to diversity : Is it necessary for a private-sector organization to make a public commitment to diversity?
Explain cost of capital of amazon : Explain cost of capital of amazon
Answer the following : What is final value of y after executing the following code.
Factors that affect hrm : Factors that affect HRM - Besides cultural differences, what other factors affect HRM in an organization with international operations?
Program program that converts eight (8) bit binary numbers : Write down a C++ program that converts eight (8) bit binary numbers to their decimal equivalents. The program should retrieve the binary numbers (one at a time) from a data file (use a long int for the variable that represents the binary number).
Analyze three functional areas : Prepare a written recommendation that holistically addresses a problem or business need: Analyze three functional areas
Explaining inclusive environment : What is meant by an "inclusive environment"? Provide examples.
Explain ebusiness strategy : What do you meant by ebusiness and explain ebusiness strategy with example
Make use of a group box to enclose the radio buttons : You have been hired by an engineering company to develop software to perform advanced geometric calculation. Your new boss asked you to develop an application that allows engineers to calculate the surface area and the volume of a sphere.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What is requirements definition

An aspect of the preferred process for almost all formal software development approaches is to do some design before coding. One of the plan artifacts you are asked to use in this course is a flow chart.

  The difference between a worm and a trojan horse

What do you tell him is the difference between a worm and a Trojan horse. List at least six reasons you can give John for preventing viruses and other malware.

  Creating a program that creates a single tips object

Creating a program that creates a single Tips object

  What devices use to get efficient network communication

CNT Books has expanded considerably as you first got network up and running three years ago. It at the present occupies an entire floor in building, and its LAN has full-grown to contain several servers and more than 60 workstations.

  Creating the table

Build a table which summarizes the risks faced by the RMO for this new project. Involve four columns titled (1) Project risk, (2) Type of risk.

  What business applications may find roles useful

What business applications may find roles useful.

  The whole scope of internet users are forced change ipv6

till the whole scope of Internet users are forced to change to IPv6 there would be no acceleration of its deployment. The old saying comes into the forum; why stop using something that you know works and you are happy with this

  Make use of a group box to enclose the radio buttons

You have been hired by an engineering company to develop software to perform advanced geometric calculation. Your new boss asked you to develop an application that allows engineers to calculate the surface area and the volume of a sphere.

  Classify the use and location of firewalls

Classify the use and location of Firewalls Categorize the use and location of IPS or IDS where necessary.

  Decribe the functions of a network node manager

Explain the processes that take place during network discovery and mapping.

  What do mean by digital stratigraphy

What is digital stratigraphy? Give an instance to illustrate how digital stratigraphy is important in the field of Computer Forensics.

  Cost estimate may be made from the plan

Discuss in detail what they should do and grow a step-by-step plan for them. Make sure you reference your statements, not just a list of sources at the bottom of your post. When you post, make sure you state both "what" should be done as well as t..

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