running a program in Unix vs in Windows
- by Hristo
I'm compiling a simple program written in C and I'm using Eclipse as an IDE, both in Windows 7 and on my MacBook Pro. Very simple program my friend wrote and asked me to help him with:
int a = 0;
char b[2];
printf("Input first class info:\n");
printf("Credit Hours: \n");
scanf("%d", &a);
printf("Letter Grade: ");
scanf("%s", b);
So when I run this on my mac, each line prints and when I encounter the scanf(), I can input and continue as expected. In Windows, I have to input everything and then it will print all the lines. I'm not sure why this is happening... what is the difference b/w Windows and Mac here?
Mac:
Input first class info:
Credit Hours: 4
Letter Grade: B+
Windows:
4
B+
Input first class info:
Credit Hours:
Letter Grade:
Thanks,
Hristo