Notes week of Oct 31

string-ops.cpp

// String ops
#include <iostream>
using namespace std;
int main()
{
    string name = "League";
    // Use .at() to access characters by index
    cout << name.at(4) << endl; // 'u'
    // Can also use it to replace characters
    name.at(4) = '\0';          // replace with null char
    // Apparently, with C++ string type, nulls
    // are just skipped, but it still prints chars
    // after the first null.
    cout << name << endl;       // "Leage"

    name.at(4) = '-';
    cout << name << endl;
    return 0;
}