I'm having so much trouble with this program its not even funny. I need to write a program to enable a user to enter a digit, and be able to reverse that digit(123 to 321), average the numbers of the digit, sum the numbers, and give the largest and smallest number. I'm majorly hitting a brick wall here. Here is the two functions I have so far for this program. Anyone with some advice would be greatly appreciated!
int GetNextDigit (int &iNumber)
//Function get last number from end
{
int iDigit;
iDigit = iNumber % 10;
iNumber /= 10;
return iDigit;
}
int ReverseDigits (int &iNumber)
{
int iDigit = 0;
do
{
GetNextDigit (&iNumber);
iDigit = iDigit * 10;
GetNextDigit (&iNumber);
iDigit += iDigit;
}
while (iNumber > 0);
return iDigit;
}
Something tells me I'm getting the logic wrong, but I'm lost as to where.