Is it possible to stop the lets say for loop with a function :
for(int i = 0;i<15;i++){
cin >> input;
obj.add(input);
}
// and then have some add or some other function that checks if (x == max_size)
check(){
if(counter == max_size)
stop the foor loop and continue..
}