Question: C++ Programming Problem. Please note the following: 1. Please go through ALL directions carefully. 2. This is a C++ programming problem, so please use C++
C++ Programming Problem. Please note the following:
1. Please go through ALL directions carefully.
2. This is a C++ programming problem, so please use C++ language, not C, Java, etc. Also note the following knowledge of C++ cannot be used in this problem (I have not learned these yet): Vector, Pointer, Class, String, IO_Stream, Array, Function, Passing Array, Const. However, you CAN use the following knowledge: Loops, Cmath, Iomanip (most central knowledge for this problem) and other basic calculations etc.
3. I will provide you with some sample solutions to the problem so you can test your codes with. So please check your codes with these solutions till your code solution matches with the provided solutions before you post your answer. It would be the best if you can upload the screenshot of your own outputs.
4. I will provide you the work that I have so far so you can start with my work to save you time. Consider it a template, and please use MY TEMPLATE and keep every variable, and comment the same. The BOLDENED parts in my work are the parts I am stuck on and have no clue how to code or just do not know how to fix them. However, if you find something wrong with anything, feel free to change anything. When you post your answer, every variable, comment of mine so far should be the exact same as I provide before.
5. The problem might be long for you to read, so I appreciate your time and effort.
Here is the problem:
Write a program rootTable.cpp which reads in the number of roots, a value increment, and a precision and outputs a table of roots x 1/2 , x 1/3 , for the given number of roots and values of x equal to i times the increment up to and including 100. For instance, if the number of roots is 10, the precision is 2, and the increment is 10, then the table should be:

Run rootTable_solution.exe to see examples of the program. Your program should behave like this program with the same input and output.
1. Prompt and read in the number of roots. Store the number as an integer.
2. Prompt and read in the value increment. Store the number as an integer.
3. Prompt and read in the precision. Store the number as an integer.
4. Compute the width of each column based upon the precision. All columns after the first should have the same width. All columns should be separated by a blank space. Note that you need a minimum column width to properly display the column headers. However, for greater precision, your column width should increase with the precision.
5. Write a header row for the table. Use the column width to correctly adjust the column headers. Note that you will have to handle columns headers x^1/i differently when i is a single digit (i
6. Write the rows of the table. The first column is x. The i'th column is the value of x 1/i . Use fixed precision and the given number of digits after the decimal point specified by the precision. The decimal points in each column should line up.
Here is my code so far (Everything works except for the column heading and the values not aligning with each other. You will see why as I will print some of my outputs and the sample solution so you can spot the differences to know what is wrong with my codes):
#include #include #include using namespace std;
int main () { // Declare variables int numRoots; // Number of roots to read in int increment; // Constant increment between values int precision; // Numbers after decimal place of outputs in the table double value; // Different values for 1/x int w; // Column width float x(0); // Counter variable to calculate values
// Read in number of roots, increment and precision cout > numRoots; cout > increment; cout > precision;
// Set up loops to set up tabular outputs with different precision, incremental and root values cout for (int k = 2; k } cout for (int k = increment; k } cout
// End program return 0; }
Sample output 1 from my code: (REMEMBER THIS IS INCORRECT OUTPUT!) 
Sample output 2 from my code: (THIS IS INCORRECT OUTPUT!)

Sample solution 1 (CORRECT OUTPUT, PLEASE COMPARE THIS WITH MY OUTPUT 1 ABOVE)

Sample solution 2 (CORRECT OUTPUT, PLEASE COMPARE THIS WITH MY OUTPUT 2 ABOVE)

I will give you feedbacks as soon as possible about the logic of your codes in general. Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
