Hey, I've been using Dev Bloodshed for all my C++ learning needs however I have began reviewing the C tutorials on the site and testing some examples. The problem is none of the examples are running how they should, the getchar(); function can't be functioning properly as it closes straight after I press enter and I cannot see more than one bit of out put when I run a program.
Code:
#include <stdio.h>
int main() /* Most important part of the program!
*/
{
int age; /* Need a variable... */
printf( "Please enter your age" ); /* Asks for age */
scanf( "%d", &age ); /* The input is put in age */
if ( age < 100 ) { /* If the age is less than 100 */
printf ("You are pretty young!\n" ); /* Just to show you it works... */
}
else if ( age == 100 ) { /* I use else just to show an example */
printf( "You are old\n" );
}
else {
printf( "You are really old\n" ); /* Executed if no other statement is
*/
}
getchar();
return 0;
}
For instance this program runs and closes the second I type in my age and hit enter, it does not give me another output. I'm positive it's not the code but if it's my compiler what should I do to resolve this issue? Thanks.