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 the maximum rate

assume an 802.11b station is configured to always reserve the channel with the RTS/CTS sequence. Suppose this station suddenly wants to transmit 1,000 bytes of data, and all other stations are idle at this time.

  Developing an object-oriented model for bookstore

The bookstore wishes you to develop an object-oriented model for the new bookstore information management system.

  Recognizing the instruction format

Memory unit of the computer has 256K words of 32 bits each. The computer has an instruction format along with the four fields: an operation code field, a mode field, to state one of seven addressing modes, a register address field.

  Express a mechanism to access the telephone customer

express a mechanism to access the telephone customer.describe your selection and discuss the speed of the search operation. Keep in mind that a million records cannot be kept in one array. There is no need to code in C++.

  Recoginizing the error in given code

Identify the problem in the above code, If ( toupper( response[ 0 ] ) == 'Y' )

  What business applications may find roles useful

What business applications may find roles useful.

  Find out whether an integer is a prime number

An integer greater than 1 is a prime number if its only divisor is 1 or itself. For in case, isPrime (11) returns true, and isPrime (9) returns false.

  Creating database for company

If you were preparing to create a brand new database for a company, do you think there would be any value in the interviewing the users to determine out what colors and designs they like?

  Thadvantages and disadvantages of using pass by reference

Discuss the pros and cons of static and dynamic allocation of memory in embedded applications. Be certain to address the circumstances under which there might be potential problems.

  Give description of the network design plan

For the equipment price list, make up price list based on fair market value for each peice of equipment. Do the same for the labor costs.

  Generating the cipher text

Consider the plaintext is 101101101. If CBC is not used, what is the resulting ciphertext? If CBC is utilized along with the IV = 111, specify the resulting ciphertext? Show all work.

  How to construct a permutationgenerator object

note down  a program that produces random permutations of the numbers 1 to 10. To generate a random permutation, you need to fill an array with the numbers 1 to 10 so that no two entries of \array have the same contents.

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