- 789 名前:NAS6 ◆n3AmnVhjwc [2015/09/05(土) 22:47:45.27 ID:zGjt7Ia9.net]
- void recForFunc() { ; }
int recFor(int i, int n, int a) { if (n <= i) return i; recForFunc(); return recFor(i + a, n, a); } std::cout << recFor(0, 10, 2) << std::endl; for (i = 0; i < 10; i += 2) recForFunc(); std::cout << i << std::endl; ループと再帰の違いは スコープスタックを保存しているかしていないかだけ
|

|