This isn't a better solution, but another way to look at it :
void print1To10(){
_print(1,10);
}
void _print(const int begin, const int end){
if(begin <= end) cout << begin;
else _print(begin+1,end);
}
this will print just 1.
I think you mean :
void print1To10(){
_print(1,10);
}
void _print(const int begin, const int end){
if(begin <= end) _print(begin+1,end);
cout << begin;
}