include stdio include iostream using namespace std int inc int num int

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#include <iostream>
using namespace std;
int inc(int num, int maxnum) {
if (num < maxnum) {
num++;
inc(num, maxnum);
} else {
return num;
}
}
int main() {
int n = 1;
cout << inc(n, 5);;
return 0;
}