Work with a partner in the lab to complete the lab.
Please read till Section 4 (Loops) in Zybooks, you will be using loops and conditionals in this activity.
Quiz:
The quiz will be available in the first 5 mins of the lab:
Your lab TA will tell you the password you will need to get into the quiz for your section.
You may use either one of the lab machines or your own laptop. For the lab computers your account name and password are the same as your UIC netid and password.
After you have finished your quiz, if you have not already done so, use this google form to enter your information and acknowledge that you have read the Academic Honesty policy on the course web site, and that you agree to abide by it.
Activity:
For this lab we will be designing a pattern maker (Section 4.29 of Zybooks).
HINT: Consider the use of while loops to give the output 1 2 3 4 5
int i=1;
while( i<=5) {
cout << i << " ";
i++;
}
and a for loop to give the same output:
int i=1;for(i=1;i<=5;i++){
cout << i << " ";
}
The pattern maker takes an odd number as user input and draws the required pattern as per the level of the designer.
Change the program in to take user Input for an odd number for the pattern maker.
The Code given to you allows you to choose the pattern to be printed.
Level 1: Square (1 Point)
The pattern maker takes an odd integer as an input and outputs a square pattern.
Use the odd integer to determine the side of a square.
For example:
Welcome to Pattern maker.
Please an odd Integer for the Pattern Maker: 5
*****
*****
*****
*****
*****
Level 2: Triangle (1 Point)
The triangle pattern maker takes an odd integer as an input and outputs a Triangle pattern.
Use the odd integer to determine the max length of the triangle.
For example:
Welcome to Pattern maker.
Please an odd Integer for the Pattern Maker: 5
*
***
*****
Level 3: Diamond (Extra Credit, 1 Point)
The pattern maker takes an odd integer as an input and outputs a diamond pattern.
Use the odd integer to determine the length of the diamond.
For example:
Welcome to Pattern maker.
Please an odd Integer for the Pattern Maker: 5
*
***
*****
***
*