// Backward String //Write a function that accepts a pointer to a C-string as an
ID: 3647936 • Letter: #
Question
// Backward String//Write a function that accepts a pointer to a C-string as an argument and display its contents backward.
///??? The error is in the for loop at the = symbol. Compiler states ist is a error C2059: syntax error : '='
/// Please help I have to turn in tomorrow.
#include <iostream>
#include <string>
using namespace std;
//Function prototype
void reverseWord(string);
void main ()
{
string wordReverse; //To hold the word in revese order.
//User input data
cout << "Eenter a word and I will send it back in reverse order:" << endl;
cin >> wordReverse;
reverseWord(wordReverse);
}
void reverseWord(string str)
{
int index = 0;
//Display as reverse
cout << "The string in reverse order is :";
for (int index =str.size() -1; index > = 0; index--)
cout << str[index] << endl;
}