Tried it here, runs without any crashes / runtime errors... what compiler are you using?
also:
You'd want the code to terminateCode:if (!infile) { cout << "Fatal Exception: File could not be opened." << endl << "Press any key to terminate..."; while (!kbhit()); return 1 }
And I recommend not to use conio.h, include <iostream> (for cin and cout) and use
instead ofCode:system("pause");
And consider using a switch statement rather than your if - elseifCode:while (!kbhit());





Reply With Quote