C语言函数积累.doc

  1. 1、本文档共7页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C语言函数积累

使用前要注明:#includectype.h isdigit():判断字符是否是数字(0–9) isalpha():判断字符是否是字母(A–Z or a–z) isxdigit():判断是否是十六进制字符(A–F, a–f, or 0–9) isalnum():判断是否是数字和字母(A–Z, a–z, or 0–9)isupper():判断字符是否为大写英文字母islower():判断字符是否为小写英文字母toupper():将字符转换为大写英文字母tolower():把字符转换成小写字母ispunct():判断字符是否为标点符号有两个函数可以实现,double pow(double x, double y),double pow10(int p) 下面是这两个函数的使用方法,个人建议用:pow10(n) 函数名: pow 功 能: 指数函数(x的y次方) 用 法: double pow(double x, double y); 程序例: #include math.h #include stdio.h int main(void) { double x = 2.0, y = 3.0; printf(%lf raised to %lf is %lf\n, x, y, pow(x, y)); return 0; } 函数名: pow10 功 能: 指数函数(10的p次方) 用 法: double pow10(int p); 程序例: #include math.h #include stdio.h int main(void) { double p = 3.0; printf(Ten raised to %lf is %lf\n, p, pow10(p)); return 0; } 三角函数:(所有参数必须为弧度) ? ?1.acos ? 函数申明:acos? (double x); ?? 用途:用来返回给定的 X 的反余弦函数。 ?2.asin ?? 函数申明:asin? (double x); ?? 用途:用来返回给定的 X 的反正弦函数。 ?3.atan? ?? 函数申明:atan? (double x); ?? 用途:用来返回给定的 X 的反正切函数。 ?4.sin ?? 函数声明:sin?? (double x); ?? 用途:用来返回给定的 X 的正弦值。 ?5.cos ?? 函数声明:cos?? (double x); ?? 用途:用来返回给定的 X 的余弦值。 ?6.tan ?? 函数声明:tan?? (double x); ?? 用途:用来返回给定的 X 的正切值。 ?7.atan2 ?? 函数声明:atan2 (double y, double x); ?? 用途:返回给定的 X 及 Y 坐标值的反正切值 ? 其他函数: ?8.atof? ? 函数名: atof? (const char *s); ? 功? 能: 把字符串转换成浮点数 ? 用? 法: double atof(const char *nptr); ? 程序例: ?? #i nclude stdlib.h ?? #i nclude stdio.h ?? int main(void) ?? { ??? float arg,*point=arg; ??? float f; ??? char *str = 12345.67; ??? f = atof(str); ??? printf(string = %s float = %f\n, str, f); ??? return 0; ?? } ?9.?ceil? 和 floor ?? 函数名: ceil? ?????????????? ? floor ?? 功? 能: 向上舍入 ??????? 向下舍入 ?? 用? 法: double ceil(double x); ??????? double floor(double x); ?? 程序例: ?? #i ncludemath.h ?? int main(void) ?? { ??? double number = 123.54; ??? double down, up; ??? down = floor(number); ??? up = ceil(number); ??? printf(original number???? %5.2lf\n, number); ??? printf(number rounded down %5.2lf\n, down); ??? printf(number rounded up?? %5.2lf\n, up); ???

文档评论(0)

xy88118 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档