第二篇—阿克曼函数
#include<stdlib.h>
#include<iostream>
using namespace std;
int Ackerman(int n, int m) {
if (m == 0 && n == 1) return 2;
if (m >= 0 && n == 0)return 1;
if (m == 0 && n >= 2)return n + 2;
if (m >= 1 && n >= 1)return Ackerman(Ackerman(n - 1, m), m - 1);
}
void main() {
int n, m;
cout << "请输入n的值:" << endl;
cin >> n;
cout << "请输入m的值:" << endl;
cin >> m;
cout << "值为:\n"<< Ackerman(n,m) << endl;
system("pause");
}