Hi thanks for reading i have question to complete haveing a bit of trouble i am using VB 2010 and C++ the Question is:
Exercise 5: Pattern generation using loops
Write two C++ functions to generate the following patterns using nested looping techniques and call the functions in the main program.
Well here is a hint for your star pattern problem:
1. You are printing the same number of columns on each row unlike your other pattern problem.
2. If the column number matches row number, you will print a different character for that column.
i am not asking for the code just even different code not relating to mine that gives me an idea i am really new this and barly understand how that code wrote works could please explain a bit more on how to do that or where could read up on that sort of stuff please
I will explain the logic for dot pattern. Follow the same for the star pattern.
Requirements
1. You need to print 8 rows of dots.
2. However, each row should have only that many number of dots as the row number. In other words, row 1 will have 1 dot and row 2 will have 2 dots and row 3 will have 3 and so on.
Pseudo code
1 2 3 4
Step 1: For rows = 1 to 8
Step 2: For columns = 1 to rows //Because of requirement 2 above
Step 3: print (1 dot character)
Step 4: print a newline character to go to the next row
C++ Implementation
1. For steps 1 and 2, use a for loop
2. For step 3, use cout << '.' for printing the dot character.
3. For step 4, use cout << endl for printing the new line character.
I hope with this pseudo code combined with a little bit of learning, you will be able to complete both the patterns. Good Luck.