(Print a String Backward) Write a recursive function stringReverse that takes a string and a starting subscript as arguments, prints the string backward and returns nothing. The function should stop processing and return when the end of the string is encountered. Note that like an array the square brackets ([]) operator can be used to iterate through the characters in a string.
What will be an ideal response?
```
#include
#include
using namespace std;
void stringReverse( string, int );
int main()
{
string s = "Print this string backward.";
cout << s << '\n'; // display original string
stringReverse( strArray, 0 ); // reverse the string
cout << endl;
} // end main
// function to reverse a string
void stringReverse( string stringToReverse, int startSubscript )
{
// return when null character is encountered
if ( startSubscript == stringToReverse.length() )
return;
// recursively call stringReverse with new substring
stringReverse( stringToReverse, startSubscript + 1 );
cout << stringToReverse[ startSubscript ]; // output character
} // end function stringReverse
```
Print this string backward.
.drawkcab gnirts siht tnirP
You might also like to view...
What is true about a function call statement?
A. Every function must be called at least once. B. A function may be called whenever it is needed. C. A function may be called only one time in a program. D. A function may not be called from separate functions.
If the correct spelling of a word does not appear in the Spelling and Grammar list, you can type it in the top section of the dialog box, then click Add.
Answer the following statement true (T) or false (F)
When performing a computer forensic investigation, you would want to be familiar with procedures used by local law enforcement officers even if you are not a law enforcement officer
Indicate whether the statement is true or false.
Explain why EAP is not an actual protocol.
What will be an ideal response?