Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Problem Program p01 converts a rational, decimal number to a corresponding value in a foreign base. A foreign base, f is constrained to the

C++ Problem

image text in transcribed

Program p01 converts a rational, decimal number to a corresponding value in a foreign base. A foreign base, f is constrained to the range 2s f s 36 Project 1 consists of file p01.cpp File po1.cpp Project Program Files Description File p01.cpp contains functions that process command line arguments and direct the process of reading, converting, and printing origina input values together with corresponding output values. Project file directory Project files must be stored in the root directory of your student account. Failure to store project files in the root directory of your student account will result in a score of zero (0) for this project. Command Line: Project 1 can be invoked with zero, one, or two program parameters. The first program parameter is the input file name. The second parameter is the output file name. Sample command lines together with corresponding actions by program p01 are shown below. Boldfaced type indicates data entered at the keyboard by the user p01 Enter the input file name: i01.dat Enter the output file name: o01.dat p01 i01.dat Enter the output file name: o01.dat pO1 i01.dat o01.dat The input file contains pairs on separate lines. The first value in the pair is a rational, decimal number. The second value in the pair is an integer specifying the foreign base f, where 2s f s 36. As an example, consider the following pairs Input File 10.375 2 10.375 16 Output File Specification One line is printed for each pair in the input file. Three values are printed on a line. The first two values are the values read from the input file. The last value is the decimal equivalent of the input values. Each line is formatted. A single space is printed between each of the three values printed. The first value, a floating-point value, is printed right justified in a field of twenty (20) spaces in fixed format. The next value, an integer, is printed right-justified in a field of two (2) spaces. The last value a string, is printed right-justified in a field of twenty (20) spaces. Four factional digits are printed in the converted value Example 10.37500000 2 11181.50000000 16 1010.0110 2bad.8000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

3rd Edition

0760049041, 978-0760049044

More Books

Students also viewed these Databases questions