Write a recursive void function that has one parameter which is a positive integer. When called, the function is to write its arguments to the screen backward: If the argument is 1234, the output should be. 4321.

What will be an ideal response?


```
void backward(int n)
{
if(n<10)
cout << n;
else
{
cout << n%10; // write last digit
backward(n/10); // write rest of digits (backwards)
}
}
```

Computer Science & Information Technology

You might also like to view...

What would be the value of discountRate after the following statements are executed?

``` double discountRate = 0.0; int purchase = 1250; if (purchase > 1000) discountRate = .05; if (purchase > 750) discountRate = .03; if (purchase > 500) discountRate = .01; else discountRate = 0; ``` a. .05 b. .03 c. .01 d. 0

Computer Science & Information Technology

Unwanted electronic junk mail about medical products, low-cost loans, and fake software that arrives in your online mailbox is known as ____.

A. junk B. viruses C. spam D. propaganda

Computer Science & Information Technology

When creating a query, you can select nonadjacent tables by pressing the ________ key and clicking the desired tables from the Show Table dialog box

Fill in the blank(s) with correct word

Computer Science & Information Technology

A(n) _____ template is a template that is not matched to a node set but instead acts like a function to display a calculated value or perform an operation.

A. ?unmatched B. ?function C. ?named D. ?operator

Computer Science & Information Technology