Help Please

Hi, I'm quite new to c++ and i have been having a specific problem. i use devc++ coppiler and everytime i have thre line return o; at the end of my main function, the source code compiles but when i run it, it just closes up instantly. if i change the return o; statement to cin >> a;
where a is a variable i use in my program, the program compiles and runs successfully. i have copied programs directly from textbooks and i get the same error. pls can any one tell me what im doing wrong. Thank you


  • The console window is *probably* closing upon program termination. You might try something like below. You can also try opening a "cmd" window and then run your program by providing the full path to your application.

    int main() {
    // bits of code

    while(cin.get() != '
    return 0;


  • Thanks, the piece of code you gave solved the problem.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!