Question: Prog1: Multi-base input to binary output w/ fancy input file (CS220-02, 05) Develop a C (or C++) program that reads an unsigned number in some

 Prog1: Multi-base input to binary output w/ fancy input file (CS220-02,

Prog1: Multi-base input to binary output w/ fancy input file (CS220-02, 05) Develop a C (or C++) program that reads an unsigned number in some base and outputs the equivalent value in BCD. Please use only a single source file so I can more easily script the downloading and compiling of your submissions. 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 at-symbot (@') 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: 0101 0110 8 70 4: 0010 0100 5: 0000 6: 0100 0011 9: 0001 0010 0011 0100 0101 0110 2 011000 7 0 11 3A @ this is long 10 123456 Your output must precisely match the instructor's so test carefully against the examples. Prog1: Multi-base input to binary output w/ fancy input file (CS220-02, 05) Develop a C (or C++) program that reads an unsigned number in some base and outputs the equivalent value in BCD. Please use only a single source file so I can more easily script the downloading and compiling of your submissions. 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 at-symbot (@') 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: 0101 0110 8 70 4: 0010 0100 5: 0000 6: 0100 0011 9: 0001 0010 0011 0100 0101 0110 2 011000 7 0 11 3A @ this is long 10 123456 Your output must precisely match the instructor's so test carefully against the examples

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!