Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- #define RESULT(n, m) do{ cout << "n= " << (n) << " m= " << (m) << endl; _getch();}while(false);
- int Akker(int n, int m) {
- if (m == 0) {
- RESULT(n, m);
- return n + 1;
- }
- if (m > 0 && n == 0) {
- RESULT(n, m);
- return Akker(m - 1, 1);
- }
- if (m > 0 && n > 0) {
- RESULT(n, m);
- return Akker(m - 1, Akker(m, n - 1));
- }
- }
- int main() {
- setlocale(0, "");
- int n, m;
- cout << "Введите число n и m: ";
- cin >> n >> m;
- cout << "Результат - " << Akker(n, m);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement