running a program in Unix vs in Windows

Posted by Hristo on Stack Overflow See other posts from Stack Overflow or by Hristo
Published on 2010-05-12T03:56:24Z Indexed on 2010/05/12 4:04 UTC
Read the original article Hit count: 295

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about c