Question: In C++ Write a function that recursively prints all the digits of a number, space-separated. For example if the input is 63762, the output would

In C++

Write a function that recursively prints all the digits of a number, space-separated. For example if the input is "63762", the output would be "6 3 7 6 2 "

Prototype: void digitPrint(int n);

Note: It's posible to write this function using just three lines of code in the body. See if you can do it!

The driver used to test your code is below:

int main(){ int n; cin >> n; cout << "input: " << n << endl; cout << "output: "; digitPrint(n); cout << endl; return 0; }

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 Databases Questions!