
Here is the code for you:
#include <iostream>
using namespace std;
int menu()
{
cout<<"Which triangle do you want to
draw?"<<endl;
cout<<"1 - Left-Top-Big"<<endl;
cout<<"2 - Left-Bottom-Big"<<endl;
cout<<"3 - Right-Top-Big"<<endl;
cout<<"4 - Right-Bottom-Big"<<endl<<endl;
int choice;
cin>>choice;
while(choice < 1 || choice > 4)
{
cout<<"Illegal choice, try again: ";
cin>>choice;
}
return choice;
}
int getSize()
{
cout<<"Please enter the maximum size (1-10): ";
int size;
cin>>size;
while(size < 1 || size > 10)
{
cout<<"size must be in range of 1 - 10, try again: ";
cin>>size;
}
return size;
}
char getRepeatChoice()
{
cout<<"Draw another? (Y/N) ";
char another;
cin>>another;
while(another != 'y' && another != 'Y' && another
!= 'n' && another != 'N')
{
cout<<"Please enter Y for yes or N for no: ";
cin>>another;
}
return another;
}
void leftTopBig(int max)
{
for(int i = 0; i < max; i++)
{
for(int j = 0; j < max-i; j++)
cout<<"*";
cout<<endl;
}
cout<<endl;
}
void leftBotBig(int max)
{
for(int i = 0; i < max; i++)
{
for(int j = 0; j <= i; j++)
cout<<"*";
cout<<endl;
}
cout<<endl;
}
void rightTopBig(int max)
{
for(int i = 0; i < max; i++)
{
for(int j = 0; j < i; j++)
cout<<" ";
for(int j = 0; j < max-i; j++)
cout<<"*";
cout<<endl;
}
cout<<endl;
}
void rightBotBig(int max)
{
for(int i = 0; i < max; i++)
{
for(int j = 0; j < max-i-1; j++)
cout<<" ";
for(int j = 0; j <= i; j++)
cout<<"*";
cout<<endl;
}
cout<<endl;
}
int main()
{
while(true)
{
int choice = menu();
int size = getSize();
switch(choice)
{
case 1: leftTopBig(size); break;
case 2: leftBotBig(size); break;
case 3: rightTopBig(size); break;
case 4: rightBotBig(size); break;
}
char again = getRepeatChoice();
if(again == 'n' || again == 'N')
return 0;
}
}
And the output screenshot is:

C++ Hey, I really need help with this lab. I don't understand the function part at...
I need java code for the following problem.
Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...
(Written in C++) Your assignment is to generate an HTML multiplication table with dimensions specified by the user. You will ask the user for the number of rows then number of columns, and generate an HTML table of the appropriate size. The top left cell should contain the result of 1 x 1, and the bottom right cell should contain the result of num_rows x num_cols. Each row and column may be an integer value between 1 and 12 inclusive...
Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: o Write a method called cubeIt that accepts one integer parameter and returns the value raised to the third power as an integer. 2. Write a method called randomInRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. o Write a method called larger that accepts two double parameters and...
Using C++ language please not matlab
a. Write a function, called SumOfDigits that is able to calculate the summation of a five-digit number. This function receives one integer parameter 'a', then returns the sum of 5 digits of the number. [2.5 marks] b. Write a function, called Armstrong that prints all Armstrong numbers in the range of 0 and 500. An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is...
Hi I need help doing this problem *The program must re-prompt as long as invalid input is inserted Implement a program that manages shapes. Implement a class named Shape with a virtual function area()which returns the double value. Implement three derived classes named Diamond, Oval, and Pentagon. Declare necessary properties in each including getter and setter function and a constructor that sets the values of these properties. Override the area() function in each by calculating the area using the defined...
In C++ Write a function that receives an integer array with its size and determines whether the array is already sorted in increasing order. Write a test program (main function) that prompts the use to enter a list and displays whether the list is sorted or not. The first number in the input indicates the size of the list. Assume the maximum list size is 20.
In C++ Write a function that receives an integer array with its size and determines whether the array is already sorted in increasing order. Write a test program (main function) that prompts the use to enter a list and displays whether the list is sorted or not. The first number in the input indicates the size of the list. Assume the maximum list size is 20.
Can you send the code and the screenshot of it running?
1) Create a PYHW2 document that will contain your algorithms in flowchart and pseudocode form along with your screen shots of the running program. 2) Create the algorithm in both flowchart and pseudocode forms for the following two functions: A. Write a Python function that receives a real number argument representing the sales amount for videos rented so far this month The function asks the user for the number...
In C only Please! This lab is to write a program that will sort an array of structs. Use the functions.h header file with your program. Create a source file named functions.c with the following: A sorting function named sortArray. It takes an array of MyStruct's and the length of that array. It returns nothing. You can use any of the sorting algorithms, you would like though it is recommended that you use bubble sort, insertion sort, or selection sort...
I need help programming this question using C language. This program uses input data entered in command line at the same time when the command or .exe file is entered. They are called command-line arguments. Because everything entered in command line is taken as a string, these arguments including the command itself or the .exe file name are stored in an array of char pointers, each pointer points to the first character of a string (i.e., argument). The inputs can...