Tuesday, July 14, 2009

C compiler help please?

I downloaded DevC++.. It compilers, make exe file but when it tries to run the DOS promt snaps one second and thats it no running


even simple codes like


#include %26lt;stdio.h%26gt;


int main(void)


{


char ch='a';


int i=97;


printf("value of ch: %c; value of i: %c \n", ch,i);


return 0;


}

C compiler help please?
use gethch(); before closing curly braces in your program to pause the till yuo press any key
Reply:Hi,





Include the following line before the "return 0;" statement,





getch();





This statement will make your program to wait for the user to press a key from the keyboard; and hence your DOS window will not close with a flash and will wait for you to press a key.
Reply:Try running the programs under the DOS prompt.


This is a console programs which open a DOS style output screen then close it when finished.


But if you are already running a DOS prompt, then the output of this program will go to this screen.


No comments:

Post a Comment