Saturday, May 22, 2010

Can u plz tell me how should i use the getch() function in "C" to terminate a a program which consist

of the goto statement........

Can u plz tell me how should i use the getch() function in "C" to terminate a a program which consist
I use getch() for programs that run in a DOS window but are started by clicking in Windows. This keeps the window open so you can see a messagE:





printf("Errror 1 - Press any key\n");


endit = getch();


exit (0);
Reply:the getch() function is not use for terminating a program


it is in there to get the last characteer inputted in the program
Reply:if u use the getch() function depending on which if u want to terminate the program, you can print the command "Do u want to continue (Y/N)", where getch() can be used to get 'Y' or "N', depending on tht, u can use 'if getch()==Y' goto 'some module' else goto another module..


got it?


No comments:

Post a Comment