You should see the same problem with or without the cout if you wait long enough. Remember cout is very slow, so it may take some time but you should get the same out of memory exception if you wait long enough.
That still may not be long enough. Depending on how much memory your system has and the processor speed it could take much longer, I would guess at a figure in the tens of minutes.
Your program still has the infinite loop and you are still inserting the string into your vector, so it will still crash, sometime.
`string::find()' returns a size_t, not an int
and it returns string::npos if there are not matches, no -1
So stop aiming at your foot.
I already pointed out it's not a code i'm working on, it's just trash and mustn't be taken seriously.
That still may not be long enough. Depending on how much memory your system has and the processor speed it could take much longer, I would guess at a figure in the tens of minutes.
Your program still has the infinite loop and you are still inserting the string into your vector, so it will still crash, sometime.
It's really weird.
Without the cout the program immediately crashes. With it, I have reached about 1.000.000 while-loop execution and still doesn't crash!