Saturday, May 22, 2010

While i executing my code its taking parameretes but ?

hi I m writing a programs in Blood Shed c++ dev and I can compile and running the program its taking data values but its not giving rusult,after enterring the values its immediately terminating itself.What to do I cant understanding this why its happenning

While i executing my code its taking parameretes but ?
Arbeit is right that you would need a getch() for rectifying the problem.





Most probably your problem is that the program executes properly and displays the values but the output console closes just after the program is finished. To rectify this just put a getch() in the end of program. This fucntions asks for keyboard input (i.e pressing a key) from the user. So when the program has displayed its value it will stop at getch and wait for you to press any key. Remember you have to include conio.h for using getch().





Also look in the settings of Blood Shed C++ if there is any configuration for no closing the program windows after the program has terminated.





If you face similar problem in linux/unix then use scanf, since getch is not available on these platforms.
Reply:It could be a logical problem, as it might be completing execution based on the parameters that you are passing. Try executing program in debug mode and see whether it is working as you expect.
Reply:Are you on windows? I notice that windows people often have to put a getch() call at the end of their program to keep the text window from going away.





If that's not the issue, then you probably have a bug of some sort, but you haven't given enough information. Is there an error message? Something like "segmentation fault"? You'll need to post these details.

sympathy flowers

No comments:

Post a Comment