okay so I write to see programs in an IDE compiler, the programs run fine through the IDE, but when I run them on and other computer, the program closes before the final output is shown. Now see the weird thing is I had getchar and return in their, and it kept on doing the same thing; it never stopped for more input. If the only way I was able to correct this is with fflush (stdin), but I have never had to use this before. At first I thought maybe it was some type of corrupt or damaged development environment, so I uninstalled and deleted everything; and then reinstall it all fresh and stuff. Has anyone else come across this problem? Is there another solution besides flush?
here is my code...but it does it with everything, even hello world!
Code:
// this is where i come to test ........, by moi!!
#include <stdio.h>
main()
{
//Defining response
int iResponse = 0;
//Displaying options for controler erotica
printf("\n\tFemale Erotic Nerve Control Center\n");
printf("\nCell 1\tTurn Orgasims On\n");
printf("\nCell 2\tTurn Orgasims Off\n");
//tell me what to do
printf("\nEnter Neuron Cell: ");
scanf("%d", &iResponse);
//What will happen
if (iResponse == 1)
printf("\nErotic Sensations Now On,\n");
else if (iResponse == 2)
printf("\nErotic Sensations Now Off\n");
printf("\nexit now!\n");
fflush (stdin);
getchar();
return 0;
}