Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++

image text in transcribed

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

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions