When I finish coding my source file and compile it and no problem with that...when I choose run it open the Dos windows and closes in a fraction of a second as if it flashes once...how can i fix this prob?
When I finish coding my source file and compile it and no problem with that...when I choose run it open the Dos windows and closes in a fraction of a second as if it flashes once...how can i fix this prob?
Ok it worked but some similar problem got in the way after i enter the number that the program requires the window closes....exactly after i press enter
Code:#include<stdio.h> int main() { int number; printf("enter the number\n", number); scanf("%d", &number); number=number+1; printf("the new number is %d", number); return 0; }
Obviously, the window is going to shut as soon as the program finishes, read the FAQ that Tonto posted carefully.
when i try running the prog from CMD it opens dev.
Ok im shouting now. READ ON THE LINK ABOVE !!
This is a very simple problem just read on the link tonto gave to you.
peace
i did man and still after i enter the number and press enter it shutsdown and when i open from CMD from the beginning of all it opens dev.
> when i open from CMD from the beginning of all it opens dev.
Try running the executable program (prog.exe), not the source code (prog.cpp)
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
it worked finally...thanks guys