Question: Cos1511 Assignment 4 Question 4 (C++ coding) QUESTION 4: VOID FUNCTIONS A function named printTabs (with no parameters) produces a table as the numbers 1

Cos1511 Assignment 4 Question 4 (C++ coding)

QUESTION 4: VOID FUNCTIONS A function named printTabs (with no parameters) produces a table as the numbers 1 to 10, their squares and their cubes as shown below. NUMBER SQUARE CUBE 1 1 1 2 4 8 3 9 27 4 16 36 5 25 125 6 36 216 7 49 343 8 64 512 9 81 729 10 100 1000

QUESTION 4a Write the function printTabs. Include the function in a working program named question4.cpp and call function printTabs from main().

QUESTION 4b Modify program question4.cpp by adding a function selTabs to accept the starting value of the table, the number of values to be displayed, and the increment between the values. If the increment is not explicitly sent, the function should use a default value of 1. A call to selTabs(6,5,2)should produce a table of five lines, the first line starting with number 6 and each succeeding number increasing by 2. A sample run: Enter the starting value of the table 6 Enter the number of values to be displayed 5 Enter the increment between the values 2 NUMBER SQUARE CUBE 6 36 216 8 46 512 10 100 1000 12 144 729 14 100 1000

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 Programming Questions!