Question: I just need a help in writing this c++ program please In this lab you will write a program that generates a table of numbers,

I just need a help in writing this c++ program please Inthis lab you will write a program that generates a table ofI just need a help in writing this c++ program please

In this lab you will write a program that generates a table of numbers, writing the results to a text file The program should begin by prompting the user for start, stop, and step values (integers). These values will be used to control a for loop that will generate the required table rows Be sure to validate the input stop must be greater than start step must be greater than C The total number of iterations must not exceed 50 . . o Iteration count is: (stop start) /step+ 1 If one of the above rules is broken, output an informative message to the console and have the user re-enter new values. For example, the output from a program run might look like this: Enter start, stop, and step values (space separated): 5-5 2 Oops! stop value must be greater than start value Enter start, stop, and step values (space separated):5 10 -2 Oops! step value must be greater than 0 Enter start, stop, and step values (space separated):5 5000 5 Oops! number of iterations should not exceed 50 Enter start, stop, and step values (space separated): 1 3 1 Table written to number-table.txt Once valid parameters have been accepted from the user, the program should open the file number-table.txt for write, and begin by writing a table header" to it that looks like this: Number Squared Cubed Square-Root Note that the columns have field widths of 10, 10,10, and 15 respectively. All columns are right-justified (the default). Number, Squared, and Cubed values should all be int, whereas the Square-Root value should be double with a precision of 8 decimal places. Here are a couple of sample runs: Enter start, stop, and step values (space separated): 1 5 2 Table written to number-table.txt and the contents of number-table.txt: Number Squared Cubed Square-Root 27 125 1.00000000 1.73205081 2.23606798 25 The results of a second run: Enter start, stop, and step values (space separated):10 50 10 Table written to number-table.txt ...and the contents of number-table.txt Number Squared Cubed Square-Root 10 20 30 40 50 100 400 900 1600 2500 1000 8000 27000 64000 125000 3.16227766 4.47213595 5.47722558 6.32455532 7.07106781 Hints: 1) Remember to include to access the sqrt() function. 2) Declare constants for precomputed values (e.g. field widths) 3) Don't forget to check that the file opened successfully (and return 1, to indicate an error, if it didn't). 4) Use the setw(n) manipulator to set the field widths. 5) You can use setw() and setfill) to output a line of dashes

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!