My Program :
#include <iostream>
#include <string>
using namespace std;
void Reverse(string &InputString);
void CharSwap(char& First, char& Second);
void main(void)
{
string InputString;
cout << "Please enter the string to reverse ==> ";
getline(cin, InputString);
cout << endl << "You entered the (" << InputString.length()
<< ") char long string: ";
for(int i = 0; i < InputString.length(); i++)
cout << InputString[i];
Reverse(InputString);
cout << endl << "The string reversed is : ";
for(int j = InputString.length(); j > 0 ; j--)
cout << InputString[j];
cout << endl << endl;
}
void Reverse(string &InputString)
{
int Begin = 1,
End = InputString.length();
while(Begin < End)
{
CharSwap(InputString[Begin], InputString[End]);
Begin++;
End--;
}
}
void CharSwap(char& First, char& Second)
{
char Temp;
First = Second;
Temp = First;
Second = Temp;
}
<< moderator edit: added [code][/code] tags >>
Will not work It comes up with the error message "Line 11 `main' must"
How do i fix this thanks