If I try to run the following simple code under Cygwin on Windows 7,
#include <stdio.h>
int main() {
int i1, i2, sums;
printf( "Enter first integer
" );
scanf( "%d", &i1 );
printf( "Enter second integer
" );
scanf( "%d", &i2 );
sums = i1 + i2;
printf( "Sum is %d
", sums );
return 0;
}
it compiles (via gcc) without a problem, but when I try to execute it, the first statement ("Enter first integer") isn't printed to the terminal, and I have to input two successive numbers (e.g. 3 and 4) before I get,
3
4
Enter first integer
Enter second integer
Sum is 7
Can anyone explain to me what is happening here. This works perfectly well under MinGW.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…