2011年1月10日 星期一

[C]常用函式表


函式名所需之標頭檔簡便使用方法備註
printf()stdio.hprintf("字串", 參數... )列印函式
scanf()stdio.hscanf("字串", 參數... )鍵盤輸入函式,請注意 "&"
pow()math.hpow(x, y)x 的 y 次方,傳回值為 double
floor()math.hfloor(x)取小於 x 的最大整數,x為double,如:floor(3.14)=3。
ceil()math.hceil(x)取大於 x 的最小整數,如:ceil(3.14)=4。
sqrt()math.hsqrt(x)把 x 開根號
strlen()string.hstrlen(字串的名字)計算字串資料的長度。
strcmpstring.hstrcmp(字串1, 字串2)比較兩個字串的異同。傳回值為 0 時,兩字串相同;反之,則不相同。
strcpystring.hstrcpy(字串1, 字串2)將字串2 拷貝一份到字串1。 原來在字串1 的資料將會覆蓋而消失。



沒有留言:

張貼留言