String reverse, std::string does not allow character assignment?
This is a reverseString code using std::string. But it does not work..

    #include <string>
    #include <iostream>
    using namespace std;

    main(){
    string input;
    int i,j;
    cout << "Enter a string: ";
    getline(cin,input);
    string output;
    for(i=0,j=input.length()-1;i<input.length();i++,j--)
    output[i]=input[j];

    cout << "Reversed string = " << output;
    cin.get();
    }

But if we replace string output as char output[100]; it works. So std::string does not allow character assignments?
String reverse, std::string does not allow character assignment?
===

This is a reverseString code using std::string. But it does not work..

    #include <string>
    #include <iostream>
    using namespace std;

    main(){
    string input;
    int i,j;
    cout << "Enter a string: ";
    getline(cin,input);
    string output;
    for(i=0,j=input.length()-1;i<input.length();i++,j--)
    output[i]=input[j];

    cout << "Reversed string = " << output;
    cin.get();
    }

But if we replace string output as char output[100]; it works. So std::string does not allow character assignments?