b2d Subj : Re: Windows Prompt Runtimes SHORT-Debug To : borland.public.cpp.borlandcpp From : Jeremy Pham Date : Mon Jun 21 2004 06:59 am "Ed Mulroy [TeamB]" wrote: >The situation is this: > >When your program is run it requests that Windows create a console >window. Windows does that and your program runs. When your program >finishes the console window is requested to close. This is normal >operation. > >You wish for the window to stay open until you are finished looking at >the console window. To do that your program must pause until you are >ready for it to close. > >The method Mr Salzman provided works well. CONIO.H must be included >to provide the function prototype for getch. That does not mean >STDIO.H should be removed. > >Since you do not like getch() here are two other methods to achieve >similar results. > >- Place this on the line immediately before the return statement in >main > getchar(); > It might be better if done in this way > printf("Press Enter ... "); > getchar(); > >- place a breakpoint on the return statement in main > >. Ed Man, too bad I'm not expert. I did some revisions and prompt is still short. I'll need help revising. Here's the first program: #include main() { int num1, num2; printf("Enter two integers, and I will tell you\n"); printf("the relationships they satisfy: "); scanf("%d%d", &num1, &num2); if (num1 == num2) printf("%d is equal to %d\n", num1, num2); if (num1 != num2) printf("%d is not equal to %d\n", num1, num2); if (num1 < num2) printf("%d is less than %d\n", num1, num2); if (num1 > num2) printf("%d is greater than %d\n", num1, num2); if (num1 <= num2) printf("%d is less than or equal to %d\n", num1, num2); if (num1 >= num2) printf("%d is greater than or equal to %d\n", num1, num2); return 0; } Here's the second revision: #include main() { int num1, num2; printf("Enter two integers, and I will tell you\n"); printf("the relationships they satisfy: "); scanf("%d%d", &num1, &num2); if (num1 == num2) printf("%d is equal to %d\n", num1, num2); if (num1 != num2) printf("%d is not equal to %d\n", num1, num2); if (num1 < num2) printf("%d is less than %d\n", num1, num2); if (num1 > num2) printf("%d is greater than %d\n", num1, num2); if (num1 <= num2) printf("%d is less than or equal to %d\n", num1, num2); if (num1 >= num2) printf("%d is greater than or equal to %d\n", num1, num2); printf("Press enter..."); getchar(); return 0; } Yeah, this thing still runs short. Can you help me revise? Once again guys, thanks a lot for the help. Thanks, Jeremy Pham . 0