Question: In this Lab assignment, you need to define the following THREE functions: Define a function bool create _ PowerOfTwoMinusOne ( int num, int& goal )

In this Lab assignment, you need to define the following THREE functions:
Define a function bool create_PowerOfTwoMinusOne (int num,
int& goal) that decides if num is a "Power of Two Minus One number" as
you have solved in Lab4. If it is, return true; otherwise return false. At the same
time, your function needs to set up goal to the closest "Power of Two Minus
One number" which is less than or equal to num. For example, if num is 15, after
calling create_PowerOfTwoMinusOne (num, goal), it should return true
and goal will be set to 15 ; if num is 33, after calling
create_PowerOfTwoMinusOne (num, goal), it should return false and
goal will be set to 31 ; if num is 215, after calling
create_PowerOfTwoMinusOne (num, goal), it should return false and
goal will be set to 127.
Define a function void drawTri (int n ) that prints a triangle which
contains one little star (asterisk symbol) at the first line, three starts at the second
line, and so on till 2*n-1 little stars at the nth line, and it is symmetric. For
example, the triangle with n=5 is shown in the following:Define a function void drawTriR90(int n ) that prints a triangle obtained
after rotating the original triangle from calling drawTri (n),90 degrees
clockwise. For example, the triangle with n=5 is shown in the following:
??? drawTriR90() is equal to:
//after 90 degree rotation clockwise from the original pattern by calling drawTri()
****
Write a program that repeatedly asks the user to enter a Positive integer as the input,
until the user enters -1 to quit the program. Each time after the user inputs a valid
positive integer, it then prints:
Decide whether the user-input Positive number, say input, is a "Power of Two
Minus One" by calling the function
create_PowerOfTwoMinusOne (input, goal);
It prints the triangle pattern in which the last row of stars matches the value of
goal from step 1), then prints the triangle pattern after rotating 90 degrees
clockwise.
In this Lab assignment, you need to define the

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!