The problem:
Code:
The name of the function's name should be reverse. Let the
name of its value parameter be x (which is an int). The
return datatype should be int. Use the main() driver program
provided below to test your function:
#include <iostream>
using namespace std;
// insert the reverse function here.
int main()
{
int num;
cin >> num;
cout << "Reverse of " << num << " is " << reverse(num) << endl;
return 0;
}
I know what I should do to obtain the reverse number, but its harder when using a function int. The program should handle any as much digits it can handle. So I know I should use a loop, and also you should know the number of digits - I've done that. My question is what is the proper way of returning the reverse digits. And by the way our lesson is about REFERENCES AND REFERENCE PARAMETER.