Question
Write a program containing a function, reverseDigit , that takes an integer as a parameter and returns the number with its digits reversed, then printout
Write a program containing a function,reverseDigit, that takes an integer as a parameter and returns the number with its digits reversed, then printout the return result. For example, the value ofreverseDigit(12345) is 54321; the value ofreverseDigit(5600) is 65; the value ofreverseDigit(7008) is 8007; and the value ofreverseDigit(-532) is -235.
Modify the following program to make a correct output.
Modify the following program to make a correct output.
/*
// Name: Your Name
// ID: Your ID
*/
// include statement(s)
// using namespace statement
#include
using namespace std;
int reverseDigit(int num);
int main ()
{
int num;
cout << "Enter an integer: ";
...
...
...
cout << ~~~
<< "The return value is " ~~~
<< endl;
return 0;
}
int reverseDigit(int num)
{
int reverseNum = 0;
...
...
...
return reverseNum;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started