I can't reverse the inputted word...
Here is my code... Please correct it...
Sample Output:
Type word(s): hello
The reverse is: 'olleh'
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
char orig [300];
char rev [300];
int len;
void original ()
{
cout << "\n\n\tType word(s): ";
cin.getline (orig,300);
}
void reversed ()
{
int x = 0;
int y = len;
for (x=0;x<y;x++)
{
rev [x]=orig [y-x];
}
}
void main ()
{
clrscr ();
original ();
len = strlen (orig);
reversed ();
cout << "\n\n\tThe reverse is: '" << rev << "'.";
getch ();
}