Hello all. First of all thank you for your time and assistance! I'm a c++ newbie (been learning it from scratch for the last couple of days). I've also started learning Python too.
I've got a simple code that creates a dynamic array of characters that a user can add an aditional character too. The code then prints how many elements there are. The final line of my code is to print the array to screen (so in effect printing the characters within the array). However I keep getting a "no match for 'operator<<' error. I've searched around for exactly what this means and how to rectify it but am coming up stumped. The code is below
DynArrChar is not an array, it's a vector. As the error says, no operator << has been defined where the right hand side operand is of the std::vector<char>. You'll have to define it yourself.
A vector is different from character array. A vector is not a collection of characters, but a collection of whatever type it was defined as. In order to print out the vector you could try this:
1 2 3 4
for (int i = 0; i < DynArrChar.size(); i++)
{
cout << DynArrChar[i] << endl;
}