I am writing a program that can add letters to a vector then display all elements of the vector. However, once I add letters, the vector doesn't print out anymore in the letterList function. Can anyone help me make this successful?
vectors work like arrays.
vector.resize(i);
vector[i] = x; // <-- still out of bounds, just like int x[10]; x[10] = 42;
that is lines 8 and 9. there could be other bugs, but I stopped reading there.
why not use push back?
vector<char> notastring;
for(int i = 0; i < 10; i++)
notastring.push_back(i+'a');
notastring.push_back(0);
cout << ¬astring[0]; //like a c-string, using the 0 character I put into it, its one of many ways to do it (your loop works, but its a little brute-forceish).