Hi, I am writing this code for a class I am taking. It works fine as long as i do not use more 9 digits in length, but my teacher wants the user to be able to be able to input a number of any length. The warning when i build it is " : warning C4715: 'reverse' : not all control paths return a value". Any help would be appreciated. :)
#include <iostream>
using namespace std;
int reverse(int num);
int main()
{
cout << "Enter the number you wish to reverse: ";
int number;
cin >> number;
cout << reverse(number) << endl;
}
int reverse(int num)
{
do
{
if (num >= 10)
{
cout << (num % 10);
}
else
{
return num;
}
num = num / 10;
}
while (num > 0);
}