in c++ MULTIPLICATION TABLES Write a program that generates multiplication tables for the user. The program will ask th

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

in c++ MULTIPLICATION TABLES Write a program that generates multiplication tables for the user. The program will ask th

Post by answerhappygod »

in c++
MULTIPLICATION TABLES Write a program that generatesmultiplication tables for the user. The program will ask the userfor a number and generate a multiplication table for that number.Do NOT use functions or arrays on this.(You need nested for loops for this!)
Needs header, called player.h, and implementation, calledplayer.cpp. Then have a main that will include the headerfile:#iinclude "player.h"
The program should start by displaying a menu similar tothis:
MENU
a) Generate Multiplication Table
q) Quit Program
Please make a selection:
-If the user selects ‘a’: the program should then ask the userto enter a number and generate a multiplication table for thenumber the user entered. The program should then display thatmultiplication table. See the example outputs below for how themultiplication table should look (follow the formatting).
Input Validation: Do not allow the user to enter a number lessthan 1 or greater than 10 as the number to generate amultiplication table for.
-If the user selects ‘q’: quit the program
-If the user enters any letter other than ‘q’ or ‘a’: print themessage “Invalid Selection” to the screen and redisplay themenu.
-The user should be able to generate as many multiplicationtables as they would like.
HINTS:
1. Use a while loop or do-while loop to allow the user to beable to keep generating multiplication tables until they choose toquit the program
2. First, try to get the multiplication table working withoutany formatting. This is most easily done using nested for loops (afor loop to go down the rows, which contains a for loop to goacross the columns – look at the end of Chapter 5 lecture).
3. Add each of the formatting items one at a time and test theprogram until each item of formatting is working correctly beforeadding the next formatting item. There are different ways to adddifferent parts of the formatting. Additional loops may work forcertain parts of the formatting. You also may want to use the setwmanipulator.
**PSEUDOCODE IS NOT REQUIRED FOR THIS PROGRAM
Example Output: (This would be the output if the user enteredsome invalid selections then finally the number 4)
MENU
a) Generate Multiplication Table
q) Quit Program
Please make a selection: w
Invalid Selection
MENU
a) Generate Multiplication Table
r) Quit Program
Please make a selection: a
Enter size of multiplication table: 11
Size range must be 1 to 10
Enter size of multiplication table: 4
MULTIPLICATION TABLE: 4's
1 2 3 4
1 1 2 3 4
2 2 4 6 8
3 3 6 9 12
4 4 8 12 16
Example Output: (This would be the output of the table if theuser entered the number 10), again, you do need to format and printthe header (top line) and row number (first column)
MULTIPLICATION TABLE: 10's
1 2 3 4 5 6 7 8 9 10
1 1 2 3 4 5 6 7 8 9 10
2 2 4 6 8 10 12 14 16 18 20
3 3 6 9 12 15 18 21 24 27 30
4 4 8 12 16 20 24 28 32 36 40
5 5 10 15 20 25 30 35 40 45 50
6 6 12 18 24 30 36 42 48 54 60
7 7 14 21 28 35 42 49 56 63 70
8 8 16 24 32 40 48 56 64 72 80
9 9 18 27 36 45 54 63 72 81 90
10 10 20 30 40 50 60 70 80 90 100
Test Case 1
\nMENU\na) Generate Multiplication Table\nq) Quit Program\nPlease make a selection: gENTERInvalid Selection\n\nMENU\na) Generate Multiplication Table\nq) Quit Program\nPlease make a selection: aENTEREnter size of multiplication table: 12ENTERSize range must be 1 to 10\nEnter size of multiplication table: 7ENTER\nMULTIPLICATION TABLE: 7's\n\n 1 2 3 4 5 6 7\n 1 1 2 3 4 5 6 7\n 2 2 4 6 8 10 12 14\n 3 3 6 9 12 15 18 21\n 4 4 8 12 16 20 24 28\n 5 5 10 15 20 25 30 35\n 6 6 12 18 24 30 36 42\n 7 7 14 21 28 35 42 49\n\nMENU\na) Generate Multiplication Table\nq) Quit Program\nPlease make a selection: aENTEREnter size of multiplication table: 10ENTER\nMULTIPLICATION TABLE: 10's\n\n 1 2 3 4 5 6 7 8 9 10\n 1 1 2 3 4 5 6 7 8 9 10\n 2 2 4 6 8 10 12 14 16 18 20\n 3 3 6 9 12 15 18 21 24 27 30\n 4 4 8 12 16 20 24 28 32 36 40\n 5 5 10 15 20 25 30 35 40 45 50\n 6 6 12 18 24 30 36 42 48 54 60\n 7 7 14 21 28 35 42 49 56 63 70\n 8 8 16 24 32 40 48 56 64 72 80\n 9 9 18 27 36 45 54 63 72 81 90\n 10 10 20 30 40 50 60 70 80 90 100\n\nMENU\na) Generate Multiplication Table\nq) Quit Program\nPlease make a selection: qENTERQuitting\n
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply