Nested for loops

So I have a nested for loop here, what I need to be able to do is have each row do something else, but have there be a total of 5 rows and 5 columns. Every video / example that I've come across is generally printing a pattern out that is of * or some other symbol.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <conio.h>

void pattern();
using namespace std;

int main()
{
	pattern();
	_getch();
	return 0;
}

void pattern() {

	for (int row = 1; row <= 5; row++) {

		for (int b = 2; b <= 10; b++) {
			if (b % 2 == 0) {
				cout << b << " ";
			}
			
		}
		cout << endl;
	}

}


So just as an idea, I would need to have a second row do something like: print out numbers 3-15 incremented by 3 each time. I wouldn't have any issue coding this part, just simply implementing it. I'm just having issues making my second row independent. I've tried a few different times, and it ends up doing printing out my numbers multiple times. If anyone knows of any videos that would help to better explain this, I would greatly appreciate it. Thank you.
Maybe something like this:
1
2
3
4
5
6
if( row == 2 ) {
    for( int i{ 1 }; i <= 5; i++ )
        cout << 3 * i << " ";
                
    continue;
}
This is what I finished with:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <conio.h>

void pattern(); //Function prototype
using namespace std;

int main()
{
	pattern(); //Function call
	_getch(); //Allows program to remain open
	return 0;
}
/*********************************************
This function creates a pattern
with 4 rows, first row increments by 2
second row by 3, third by 4, and fourth by 5.
Each ending number in rows are incremented by 5.
*********************************************/
void pattern() {
	int step = 2; //Sets first number = 2
	int end = 10; //Sets first ending number = 10
	for (int i = 0; i < 4; i++) { //Sets limit for 4 rows
		for (int b = step; b <= end; b += step) {  //Increments b by step until <= end
			cout << b << " ";
			
		}
		cout << endl; //Spacing
		end += 5; //Increment end before going to outer for loop
		step++; //Increment step before going to outer for loop
	}
	
}


I was trying to go about it the completely wrong way. I was attempting to make a for loop for each line.

Maybe something like this:


Thank you for your input though!
Topic archived. No new replies allowed.