Complete the two modules in C++ (void functions) to display the two specified patterns when calling them from main. Set up main and the two void functions. Run the program with the four calls below and confirm the output. Submit both source code and output.
// calls from main
rectanglePattern(3, 4); // 3 by 4 rectangle of # characters
rectanglePattern(2, 5); // 2 by 5 rectangle of # characters
trianglePattern(3, ‘*’);
trianglePattern(4, ‘#’);
Sample output:
Author: [Your name]
####
####
####
#####
#####
*
**
***
#
##
###
####
You must use a nested loop and output one ‘#’ at a time inside the inner loop. Each line has up to rows ‘#’ characters (inner loop) and there are rows of lines of characters (outer loop).
void rectanglePattern(int rows, int cols)
// set up a nested loop using rows and cols
// use cout << ‘#’; inside the nested loop
You must use a nested loop and output one character at a time inside the inner loop. The first line has one character and the nth row has n characters.
void trianglePattern(int rows, char c)
// set up a nested loop using row and outer loop counter
// use cout << c; inside the nested loop
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- C++ CODEarrow_forward8. using c++, Write a function method that determines the mean of all the values in an array of integers. Your mean function should call a separate function that you write that determines the sum. Don’t use built-in sum or mean gadgets, but roll your own.arrow_forwardIn C++ please follow the instructions Write two code blocks -- one code block to declare a bag and its companion type-tracking array (both using the STL vector), and another code block to create and declare a Cat object and put it into the bag. Name the arrays and variables as you wish. Use any data type tracking and any designation for cats -- your choices. Assume that struct Cat is already defined and that all required libraries are properly included -- just write the two separate code blocks, separated by one or more blank lines.arrow_forward
- I need help creating a C++ Code. I need help Designing a PayRoll class that has data members for an employee’s hourly pay rate and the number of hours worked. Write a program with an array of seven PayRoll objects. The program should read the number of hours each employee worked and their hourly pay rate from a file and call class functions to store this information in the appropriate objects. I have a file named Data 1.It should then call a class function, once for each object, to return the employee’s gross pay, so this information can be displayed. I have attached the data that I was using.40.0 10.00 38.5 9.50 16.0 7.50 22.5 9.50 40.0 8.00 38.0 8.00 40.0 9.00arrow_forwardLocal declarations are those that are kept in the memory of the computer; but, how exactly are they kept in memory? If reaching one's objective can be done without making use of local declarations, then doing so is a waste of time. Why bother using value parameters when you can just use references as your arguments in any function? How crucial are value parameters when it comes to the processing of programmed data?arrow_forwardWhat keyword is needed to be added before an array is passed to a function to prevent the program from making changes to that parameter. this is for c++ and i think its 'const' but not surearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education