Pattern w/o loops

I have a star pattern: 2^n. How could I make it without using loops (i.e., using functions). I'm hitting blanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <cmath>

using namespace std;
int main()
{

	int r = 0;
	double k;

	for (int r = 0; r < 7; r++)
	{
		k = pow(2, r); 
		for (int c = 0; c < k; c++)
		{
			cout << "+";
		}
		cout << endl; 
		
	}
	return 0;
}


The pattern in question, using loops ^
Recursion can be used to produce iteration without loops.
Topic archived. No new replies allowed.