Question: Binary, Hexadecimal, Decimal C++ Program REQUESTED: Guidance how to design the program described below. // pseudocode or whatever is easiest for you RESTRICTED: No C++
Binary, Hexadecimal, Decimal C++ Program
REQUESTED: Guidance how to design the program described below. // pseudocode or whatever is easiest for you
RESTRICTED: No C++ conversion libraries, i.e., stol, atoi, std::hex, etc.
ALLOWED: #include
NOTE: Conversions must be done using for loops, multiply, divide, modulo, and any helper functions to convert between characters and integers. You must implement at least three functions (not including main().
Create a C++ program driven by an input file. The first line of the file contains the number of lines in included the file. Each line in the file has four pieces of information in each line:
- A character (char) that represents the number base used in the line (B for binary, H for hex, D for decimal)
- A first number (a string of numeric / alphanumeric characters of the number base type as specified in 1)
- An operand, either + or *, for addition or multiplication respectively
- A second number (in the number base as specified in 1)
SAMPLE INPUT FILE:
3 // this is first line; the integer three (3) indicates the number of lines in the input file. Use this to iterate over the inputs.
B 1011000101 + 1101001 // this is the second line; B denotes binary values
H FFFF * 123ABC // this is the third line; H denotes hexadecimal values
D 123 + 456 // this is the fourth line; D denotes decimal values
OUTPUT: For each of the lines, output the result of the calculation in the number system specified in (1).
Example: if the line is: D 123 + 456, then you will print 579 to the screen.
If the line is: B 101 + 101, then you will print 1010 to the screen.
Thank you in advance for your guidance!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
