拉登長官 | 回覆: 回覆: 【求助】請大家推薦有關C語言的書 引用:
這樣寫是比較簡單沒錯, 不過這樣一開始就造成了 Security Issue 了.. 語法: #include <unistd.h> #include <stdio.h> #include <stdlib.h> #define STRING_SIZE 16 int main( int argc, char *argv[] ) <--- ANSI C 定義的 main function { int res; double value; char str[STRING_SIZE]; res = fgets( str, STRING_SIZE - 1, stdin ); /* Error Checking */ if ( EOF == res ) { fprintf( stderr, "Error in receving float data from console\n" ); _exit( 1 ); } /* Successfully, convert INPUT to float value */ value = atof( str ) * 1.5; printf( "轉換後的溫度 : %f", value ); return 0; <--- 0 代表成功, 其他代表不同的意義( > 0 ) } | |
回覆 |
會員 ![]() | 我現在都還看不懂......剛剛國小老師回信說他有本當時在資策會受訓的書要給我看看...... 考完式去拿來好好K...... |
回覆 |
XML | RSS 2.0 | RSS |
本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。