Tested your code (modified to use the standard headers) on the MinGW port of GCC 3.4.2, and the program works as I would expect it to.Ok, so I use 8 for the array size and almost every problem goes away - except it still doesn't pause for the getch.
getch() is rather 'primitive'. If you want something more 'advanced', you can #include <limits>, then write:So then, other than cin, is there any other functions that could pause the program for me? Having to stop it with cin seems, I don't know, kind of primitive...
The cin.ignore() discards whatever characters may remain on the buffer, then cin.get() waits for the enter key to be pressed.Code:std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); std::cin.get();



LinkBack URL
About LinkBacks



CornedBee