Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions