所以這裏是我的程序。它寫出了一些陰毛的方塊。爲什麼我的程序結合了兩個printf命令?
#include <stdio.h>
int main(){
int a;
printf("Type an intiger.");
scanf("%i", &a);
printf("Square of that intiger is %i", a*a);
return 0;
}
當我在Eclipse中運行一個程序它首先要求我輸入一個number.I放在5.再作爲輸出它給了我
Type an intiger.Square of that intiger is 25.
應該先打印「鍵入intiger 「然後休息。但它只是結合了兩個printf命令。問題是什麼?
它應該是「整數」 –
使用我剛剛下載的最新eclipse C/C++版本,您的代碼的複製粘貼就像您期望的那樣工作。也許[在這裏下載](http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/keplersr1),然後再試一次。 –
我在這裏找到了答案: http://stackoverflow.com/questions/16877264/eclipse-c-c-printf-before-scanf-issue無論如何。 – GovernmentFX