Hi everyone,

I'm having trouble with this program, I hope you can help me with it. I have to write a function that takes an integer value and returns the number with its digits reversed. This is what I have so far...... I will put a */* where i need your help.....

```
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
#include<iomanip>
using std::setw;
[U]/* write prototype for reverseDigits */[/U]
[U]/* write prototype for width */[/U]
int main()
{
int number;
cout << "Enter a number between 1 and 9999: "'
cin >> number;
cout << "The number with its digits reversed is: "
<< setw ( [U]/* write call for width */ [/U] )
<< [U]/* write call for reverseDigits */[/U]
<< endl;
return 0;
}
[U] /* write function header for reverseDigits */[/U]
{
int reverse = 0;
int divisor = 1000;
int multiplier = 1;
while ( n > 10 ) {
if ( n >= divisor ) {
reverse += n / divisor * multiplier;
n %= divisor;
[U]/* write a line of code that reduced divisor by a factor of 10 */
/* write a line of code that increased multiplier by a factor of 10 */[/U]
}
else
divisor /= 10;
}
reverse += n * multiplier;
return reverse;
}
[U]/* write function header for width */[/U]
{
if ( n / 1000 )
return 4;
else if ( n / 100 )
return 3;
else if ( n/10)
return 2;
else
return 1;
}
```

<< moderator edit: added [code][/code] tags >>