-
Program Display
Hi,
I am using the Dev-C++ compiler and editor and have noticed that when i try to run a program, the results flash so fast i cannot see it? For example, this program to compute the alternative in ASCII tables. It seems as though if i just press the enter key, my result is 10, but should i try to type a character it flashes on my screen too fast. Any ideas on how to stop this so i can actually see the results??
thanks!
Code:
#include<stdio.h>
int main ()
{
printf("please input a character:\n");
char a=getchar();
printf("char is %c with value %d\n",a,a);
getchar();
}
-
Run the program from the command line. Either that or add a line like system("pause"); at the end of it, although system("Pause"); isn't the best way of doing it, there are lots of other alternatives, which I'm sure others on here will mention.
-
I have just figured it...i use the getchar(); twice since my program requires 2 outputs
many thanks
-