I know you can dynamically allocate memory, but i'm not really getting how to do it. Also, i'm pretty sure vectors would be good for this. I've read about these two things, but I don't get them that much... Basically I don't want the user only able to enter 4 numbers, but as many as they want until a certain condition has been met. (like in a loop). Any ideas?
std::vector<int> Numbers; // Here, your numbers will be stored.
bool CanInputNumbers = 1;
while(CanInputNumbers)
{
int NewNumber = 0;
cin >> NewNumber; // Get the number to add to the vector
Numbers.push_back(NewNumber); // Add it to the vector
}
unsignedint NumberOfNumbers = Numbers.size(); // How many numbers are there?
int First = Numbers[0]; // First number user did input? Error here if user did not input any
int Last = Numbers[NumberOfNumbers-1]; // Last number user did input? Error here if user did not input any