// Author: David Osenberg
// Prog: OsenbergDavid2.cpp
// Draw turtle graphics for the Lindenmayer system with
// production F -> F+F+ and initial word F.
#include
#include
// POST: the word w_i^F is drawn
void f (const unsigned int i) {
if (i == 0)
ifm::forward();
else {
ifm::left(-45);
f(i-1);
ifm::left(45);
f(i-1);
ifm::left(45);
f(i-1);
ifm::left(30);
}
}
int main () {
std::cout << "Number of iterations =? ";
unsigned int n;
std::cin >> n;
// draw w_n = w_n(F)
f(n);
return 0;
}