I have the following as code:
Code:
#include <stdio.h>
main()
{
char answer = getche();
char pi = 3;
if (answer != pi)
printf("\a");
}
But whenever I run the program, the \a sound (which is a beep) still goes off, no matter what I type, which is supposed to be a 3. This happens whether it says \a, a, or aaa. When it says == instead of !=, it never makes a sound. It doesn't matter if I type a 3, 4, or 8.
Is this a problem with the if statement? I'm using what is apparently a horribly outdated compiler called Digital Mars, so that may be the cause. It could also be compiler corruption, since I used a flash drive to transport the fiels from my computer to the folder, but i have no way to re-download it now, so if that's the case, I'll have to get a new compiler entirely (which I should probably do anyways).
So, is it a problem with my code or the compiler?
Semi-Edit: Before I even put the post up, I am already leaning towards the assumption that it's corrupted; it won't even open properly anymore.
Real Edit: As soon as I closed Chrome, my compiler magically opened up out of nowhere. So the compiler is working now, but that doesn't mean it isn't a compiler problem.