Question: Use the Following example and hints! This is C++ 6.8 Lab: Times Table Generator In this lab you will write a program that generates a

Use the Following example and hints! This is C++

Use the Following example and hints! This is C++ 6.8 Lab: Times

6.8 Lab: Times Table Generator In this lab you will write a program that generates a Times Table' of a size selected by the user. The table will be written to a text file The program should begin by prompting the user for a value from 1 to 12. Be sure and validate the user's input, re-prompting each time the value is not valid. For example Enter the table size (from 1 to 12): 0 Enter the table size (from 1 to 12): 15 Enter the table size (from 1 to 12): 6 Once the size has been selected, the program should generate the table of that size, writing the results to the file times-table-.txt where is the table size. Here are a couple of sample runs: Enter the table size (from 1 to 12) 4 Output written to times-table-4.txt ! and the contents of times-table-4.txt 313 6 9 12 414 8 12 16 Here's another run Enter the table size (from 1 to 12) 7 Output written to times-table-7.txt! ...and the contents of times-table-7.txt x1 3 5 6 7 1 1 23 5 6 7 2 2 6 8 10 12 14 3 1 3 6 9 12 15 18 21 414 8 12 16 20 24 28 51 5 10 15 20 25 30 35 616 12 18 24 30 36 42 717 14 21 28 35 42 49 Hints 1) Use a while loop for the input validation. 2) Use find() and replace() methods to generate thefilename from a template 3) You can use to string(n) to convert an integer to a string. 4) Each of the table columns (including the left-most) are each four characters wide 5) You'll want to use nested for loops to generate the main table contents

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!