Создание фрактального узора с помощью рекурсииC++

Программы на C++. Форум разработчиков
Anonymous
 Создание фрактального узора с помощью рекурсии

Сообщение Anonymous »

Я пытаюсь создать этот фрактальный узор с помощью рекурсии.

Код: Выделить всё

*
* *
*
* * * *
*
* *
*
* * * * * * * *
*
* *
*
* * * *
*
* *
*
Мне нужно реализовать следующую функцию:

Код: Выделить всё

void pattern(ostream& outs, unsigned int n, unsigned int i);
// Precondition: n is a power of 2 greater than zero.
// Postcondition: A pattern based on the above example has been
// printed to the ostream outs. The longest line of the pattern has
// n stars beginning in column i of the output. For example,
// The above pattern is produced by the call pattern(cout, 8, 0).
Пока что у меня есть:

Код: Выделить всё

void pattern(ostream& outs, unsigned int n, unsigned int i){

if (n == 1){
outs 

Подробнее здесь: [url]https://stackoverflow.com/questions/40251828/creating-fractal-pattern-using-recursion[/url]

Вернуться в «C++»