0% found this document useful (0 votes)
15 views

"!olleh": // Show M Parameter in Reverse Mode

This C++ program takes a string as input, reverses it, and outputs the result. The main function defines the string, calls the reverse function to manipulate it, and displays the original and reversed strings. The recursive reverse function takes each character of the input string and outputs it in reverse order, base case being the null character at the end of the string.

Uploaded by

hmurcia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

"!olleh": // Show M Parameter in Reverse Mode

This C++ program takes a string as input, reverses it, and outputs the result. The main function defines the string, calls the reverse function to manipulate it, and displays the original and reversed strings. The recursive reverse function takes each character of the input string and outputs it in reverse order, base case being the null character at the end of the string.

Uploaded by

hmurcia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

#include <iostream>
using namespace std;
void reverse(const char []);
int main() {
const char s[] = "!olleH";
cout << s << endl;
reverse(s);
cin.get();
}
// Show m parameter in reverse mode
void reverse(const char m[]) {
if (*(m+1))
reverse(m+1);
cout << m[0];
}

You might also like