skip to Main Content
The smarter way
to do assignments.

Please note that this is just a preview of a school assignment posted on our website by one of our clients. If you need assistance with this question too, please click on the Order button at the bottom of the page to get started.

Develop a C (or C++) program that reads an unsigned number in some base and outputs the
equivalent value in BCD.
Your program must require a single command line argument, the name of an input file. This
input file will consist of any number of lines, each falling into one of three varieties:
1. Comment – These lines always start with an asterisk (‘*’) and should be completely
ignored.
2. Blank line – Used to visually organize the input file and should be completely ignored.
3. Data line – These are the ones your program will process and are described below.
Data lines will all have exactly two items separated by a single space character:
1. an input base (2 through 16) and
2. an input value in that base whose decimal equivalent will never be more than 6 digits
For each Data line from the input file, you must output:
1. the line number of the input file this data line is on (starting the file with line 1… same as
a text editor would show)
2. a colon followed by a space
3. the BCD equivalent of the input value , four bits at a time with one space between each
set of bits. Remember the decimal values will not exceed 6 digits, so the BCD value will
never exceed 24 bits, not including whitespace between 4-bit sets. NEVER print any
leading bit sets that contain only zeros…
a. eg, instead of 0000 0101 0000 1000, you would print 0101 0000 1000
b. only exception is if the value itself is zero, as in the example below
Example input file Expected output to console
* a first example
2 011000
8 70
7 0
11 3A
* This is long
10 123456
Results
2: 0010 0100
4: 0101 0110
5: 0000
6: 0100 0011
9: 0001 0010 0011 0100 0101 0110

GET HELP WITH THIS ASSIGNMENT TODAY

Clicking on this button will take you to our custom assignment page. Here you can fill out all the additional details for this particular paper (grading rubric, academic style, number of sources etc), after which your paper will get assigned to a course-specific writer. If you have any issues/concerns, please don’t hesitate to contact our live support team or email us right away.

How It Works        |        About Us       |       Contact Us

© 2018 | Intelli Essays Homework Service®