Develop a C (or C++) program that reads an unsigned number in some base and outputs the equivalent value in a target base. The input file providing these values will be organized to allow for comment lines and blank lines along with data lines. 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-symbol ('@') 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 3 items separated by a single space character and end with a newline: 1. an input base (2 through 36) identified in decimal. Digits representing coefficients between 10 and 35 will use the letters 'A'-'Z' and/or 'a'-'z' (i.e., they could be upper or lower case) 2. an input value in that base whose binary equivalent will never be more than 30 bits long 3. an output base (2 through 36) identified in decimal 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 equivalent of the input value in the output base using upper case letters A-Z for any coefficients with the value of 10-35. NEVER print any leading zeros a. eg, instead of 000123, you would print 123 b. only exception is if the value itself is zero, as in the example below Expected output to console Example input file e a first example 8 70 4 2: 320 4: 1C 5: 0 6: 43 2 011100 16 7 0 21 11 3A 10 Your output must precisely match the instructor's so test carefully against the examples.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

Please help in C++. Use strtol and make sure that if there are comment lines or blank lines it skips those and only reads the lines that are needed. 

Develop a C (or C++) program that reads an unsigned number in some base and outputs the
equivalent value in a target base. The input file providing these values will be organized to
allow for comment lines and blank lines along with data lines. 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-symbol ('@') 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 3 items separated by a single space character and end with a
newline:
1. an input base (2 through 36) identified in decimal. Digits representing coefficients
between 10 and 35 will use the letters 'A'-'Z' and/or 'a'-'z' (i.e., they could be upper or
lower case)
2. an input value in that base whose binary equivalent will never be more than 30 bits
long
3. an output base (2 through 36) identified in decimal
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 equivalent of the input value in the output base using upper case letters A-Z for
any coefficients with the value of 10-35. NEVER print any leading zeros
a. eg, instead of 000123, you would print 123
b. only exception is if the value itself is zero, as in the example below
Expected output to console
Example input file
@ a first example
8 70 4
2 011100 16
7 0 21
11 ЗА 10
2: 320
4: 1C
5: 0
6: 43
Your output must precisely match the instructor's so test carefully against the
examples.
Transcribed Image Text:Develop a C (or C++) program that reads an unsigned number in some base and outputs the equivalent value in a target base. The input file providing these values will be organized to allow for comment lines and blank lines along with data lines. 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-symbol ('@') 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 3 items separated by a single space character and end with a newline: 1. an input base (2 through 36) identified in decimal. Digits representing coefficients between 10 and 35 will use the letters 'A'-'Z' and/or 'a'-'z' (i.e., they could be upper or lower case) 2. an input value in that base whose binary equivalent will never be more than 30 bits long 3. an output base (2 through 36) identified in decimal 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 equivalent of the input value in the output base using upper case letters A-Z for any coefficients with the value of 10-35. NEVER print any leading zeros a. eg, instead of 000123, you would print 123 b. only exception is if the value itself is zero, as in the example below Expected output to console Example input file @ a first example 8 70 4 2 011100 16 7 0 21 11 ЗА 10 2: 320 4: 1C 5: 0 6: 43 Your output must precisely match the instructor's so test carefully against the examples.
Expert Solution
Step 1

ANSWER:-

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education