我學習Objective-C,我有這個代碼片段的問題:(scanf
)學習Objective-C和我在這個片段中的代碼問題:(scanf函數)
int main (int argc, const char * argv[])
{
@autoreleasepool {
double xnumber;
scanf("%1f",&xnumber);
printf("%f",xnumber);
}
return 0;
}
當我運行這個簡單的程序時,我無法將xnumber
的值設置爲任何值。無論我輸入什麼,它總是返回零。這個基本的程序,它只是許多練習所需的輸入...有人可以幫助我嗎?
謝謝。在我正在閱讀的小寫「L」看起來像一個數字「1」的書! – Antonio 2012-03-17 23:20:59