Help! illegal escape sequence issue

Hi, I'm new to this forum and I need help on an assignment due by midnight. I'm trying to put the value returned by str.at(5) in quotes like this: 'r' but I keep getting errors no matter what i try. Help please!

int main()
{
string str ("C++ Programming is fun!");

cout << "Length of string: " << str.length();

cout << "\nThe character at index 5: " <<\" str.at(5)"\;

cout << "\nASCII number of the character at index 5: ";

cout << "\nThe substring starting at position 19 and ending at position 21: ";

cout << "\nThe index of the first 'g' character in the string: ";

cout <<"\nThe index of the second 'g' character in the string: ";




system("pause");
return 0;
} //end function main
cout << "\nThe character at index 5: " <<"\"" << str.at(5) <<"\"";
Thanks so much!! I appreciate it!

The only thing I had to change was from double quotes to single quotes so it turned out like this
cout << "\nThe character at index 5: " <<"\'" << str.at(5) <<"\'";
Thank you!
Topic archived. No new replies allowed.