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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!