C語言常用內建函式
阿新 • • 發佈:2019-02-20
#include <stdio.h>
#include <ctype.h> //內建函式標頭檔案
int main()
{
//常用內建函式 - 0 表示假 非0表示真
printf("%d\n", isupper('a'));//判斷是否是大寫字母
printf("%d\n", islower('a')); //判斷是否是小寫字母
printf("%d\n", isalpha('a')); //返回的值是否為字母
printf("%d\n", isdigit('8')); //判斷傳入的是不是一個數字
}
#include <stdio.h>
#include <math.h> //標頭檔案
int main()
{
//常用內建函式 - 0 表示假 , 非0表示真
// ceil - 進一法 floor - 去尾法
//如果時負數,規律相反
printf("%.2lf\n", ceil(98.1)); //進一法
printf("%.2lf\n", floor(-98.9)); //去尾法
printf("%.2lf\n", sqrt(9)); //求平方根
printf("%.2lf\n", pow(5, 2)); //求第一個數字的第二個數字次冪
printf("%.d\n", abs (-98)); //求絕對值
return 0;
}
system("pause"); //按任意鍵繼續
system("cls"); //清屏
system("shutdown /r /t 180");//180秒後自動關機
system("shutdown /a");//取消自動關機