I am working on my first C++ project using the Bloodshed Dev C++ compiler. I have a class called DecisionMaker with a modification member function void addDecision ( string thisChoice)
whose task is to add the string variable thisChoice
to an array string decisions
Here is the code for the void addDecision ( string thisChoice)
function I have so far, which works until I after I enter a third option. Then it crashes, I think because I'm not defining how big the array is.
void decisionMaker::addDecision ( string thisChoice )
decisions[count] = thisChoice;
count += 1; // increment the count of entries
What I would like to be able to do is create the array with size 1. Then as the user makes entries, the size of the array is increased with each entry.
Maybe, an array is the best approach for this task. Would vector or list be better?