Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

// 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;

}










Explanation / Answer

#include #include using namespace std; //Function Prototype void stringLength(char *); void reverseString(char *); //----------------Start Main Function-------------------> int main() { const int INPUT_SIZE = 80; char input[INPUT_SIZE]; //Get the user's desired string cout