Binary conversion

Closed Posted Nov 7, 2002 Paid on delivery
Closed Paid on delivery

Write a C++ program that reads characters representing binary (base-2) numbers from a data file ( [url removed, login to view] ) and translates them to decimal (base-10) numbers. The binary and decimal numbers should be output to the screen as well as to a file [url removed, login to view] in two columns with appropriate heading.

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.

3) Complete ownership and distribution copyrights to all work purchased.

Program 3

Write a C++ program that reads characters representing binary (base-2) numbers from a data file ( [url removed, login to view] ) and translates them to decimal (base-10) numbers. The binary and decimal numbers should be output to the screen as well as to a file [url removed, login to view] in two columns with appropriate headings. Here is a sample output file:

Binary Number Decimal Equivalent

1 1

10 2

11 3

10000 16

10101 21

There is only one binary number per input line, but an arbitrary number of blanks can precede the number. The program must read binary numbers one character at a time. As each character is read, the program multiplies the total decimal value (which begins at 0) by 2 and and adds either 1 or 0 depending upon the input character. The program should check for bad data; if it encounters anything except a 0 or 1, it should output the message "Bad digit on input" and proceed to the next binary number.

Use a function to convert Binary to Decimal. The function should read in a binary number (from a single line in the file) and return its decimal equivalent. In addition, the function should accept a reference parameter of type string, which is modified to reflect the binary number read in. The function prototype should be:

int binToDec(string &binary);

For example, when the fuction is called the very first time, it returns the integer 43 and the reference parameter binary contains 101011 (see the file [url removed, login to view])

Your program will be graded on the following:

Accuracy (does it produce desired output?)

User-friendliness (are you printing out legible messages and prompts?)

Program Style - comments, indentation, named constants

What you need to turn in:

A printout of the source file, a printout of the output, and a printout of the file results.txt. Include the name of each file in your turn-in.

## Platform

This C++ program needs to run through Unix

C Programming Engineering Linux MySQL PHP Software Architecture Software Testing UNIX

Project ID: #2882508

About the project

46 proposals Remote project Active Nov 17, 2002

46 freelancers are bidding on average $20 for this job

cyclonesoftru

See private message.

$36.55 USD in 14 days
(124 Reviews)
8.2
freisoftconvw

See private message.

$25.5 USD in 14 days
(29 Reviews)
6.4
idleswell

See private message.

$17 USD in 14 days
(175 Reviews)
5.9
SelbySolutions

See private message.

$21.25 USD in 14 days
(22 Reviews)
5.4
ignaciovazquez

See private message.

$21.25 USD in 14 days
(18 Reviews)
5.4
nedani

See private message.

$21.25 USD in 14 days
(53 Reviews)
5.4
webukrainesl

See private message.

$25.5 USD in 14 days
(55 Reviews)
5.2
amarcusvw

See private message.

$8.5 USD in 14 days
(12 Reviews)
5.1
mattbarber

See private message.

$8.5 USD in 14 days
(19 Reviews)
4.9
pickingapples

See private message.

$34 USD in 14 days
(43 Reviews)
4.8
Uplink03

See private message.

$8.5 USD in 14 days
(68 Reviews)
4.8
leepwo

See private message.

$29.75 USD in 14 days
(41 Reviews)
4.7
herculesevw

See private message.

$22.95 USD in 14 days
(79 Reviews)
4.7
sarderhasnut

See private message.

$21.25 USD in 14 days
(54 Reviews)
4.8
ziran

See private message.

$11.05 USD in 14 days
(47 Reviews)
4.5
vw139994vw

See private message.

$15.3 USD in 14 days
(60 Reviews)
4.5
preyasvw

See private message.

$22.95 USD in 14 days
(34 Reviews)
4.4
emesevw

See private message.

$3.4 USD in 14 days
(111 Reviews)
4.4
vw132761vw

See private message.

$17 USD in 14 days
(33 Reviews)
4.2
hmichopoulos

See private message.

$8.5 USD in 14 days
(27 Reviews)
3.7