版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、函数大全(t开头)函数名: tan 功 能: 正切函数 用 法: double tan(double x); 程序例: #include <stdio.h> #include <math.h> int main(void) double result, x; &
2、#160;x = 0.5; result = tan(x); printf("The tan of %lf is %lfn", x, result); return 0; 函数名: tanh
3、 功 能: 双曲正切函数 用 法: double tanh(double x); 程序例: #include <stdio.h> #include <math.h> int main(void) double result, x; x = 0.5;
4、160; result = tanh(x); printf("The hyperbolic tangent of %lf is %lfn", x, result); return 0; 函数名: t
5、ell 功 能: 取文件指针的当前位置 用 法: long tell(int handle); 程序例: #include <string.h> #include <stdio.h> #include <fcntl.h> #include <io.h> int main(void)
6、 int handle; char msg = "Hello world" if (handle = open("TEST.$", O_CREAT | O_TEXT | O_APPEND) = -1)
7、160; perror("Error:"); return 1; write(handle, msg, strlen(msg); printf("The file pointer is at byte %ldn&qu
8、ot;, tell(handle); close(handle); return 0; 函数名: textattr 功 能: 设置文本属性 用 法: void textattr(int attribute); 程序例:
9、60; #include <conio.h> int main(void) int i; clrscr(); for (i=0; i<9; i+) textattr(i + (i+1)&
10、#160;<< 4); cprintf("This is a testrn"); return 0; 函数名: textbackground 功 能: 选择新的文本背
11、景颜色 用 法: void textbackground(int color); 程序例: #include <conio.h> int main(void) int i, j; clrscr(); for (i=0; i<9; i+)
12、160; for (j=0; j<80; j+) cprintf("C"); cprintf("rn");
13、0; textcolor(i+1); textbackground(i); return 0; 函数名: textcolor 功 能: 在文本模式中选择新的字符颜色 用 法: void
14、 textcolor(int color); 程序例: #include <conio.h> int main(void) int i; for (i=0; i<15; i+) textcolor(i);
15、60; cprintf("Foreground Colorrn"); return 0; 函数名: textheight 功 能: 返回以像素为单位的字符串高度 用 法: in
16、t far textheight(char far *textstring); 程序例: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) /* request aut
17、o detection */ int gdriver = DETECT, gmode, errorcode; int y = 0; int i; char msg80; /* initialize graphics
18、60;and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if
19、160;(errorcode != grOk) /* an error occurred */ printf("Graphics error: %sn", grapherrormsg(errorcode); printf("Press
20、60;any key to halt:"); getch(); exit(1); /* terminate with an error code */ /* draw some text
21、0;on the screen */ for (i=1; i<11; i+) /* select the text style, direction, and size */ settex
22、tstyle(TRIPLEX_FONT, HORIZ_DIR, i); /* create a message string */ sprintf(msg, "Size: %d", i); /* output
23、;the message */ outtextxy(1, y, msg); /* advance to the next text line */ y += textheight(msg); &
24、#160; /* clean up */ getch(); closegraph(); return 0; 函数名: textmode 功 能: 将屏幕设置成文本模式 用
25、160;法: void textmode(int mode); 程序例: #include <conio.h> int main(void) textmode(BW40); cprintf("ABC"); getch(); textmode(C40);
26、; cprintf("ABC"); getch(); textmode(BW80); cprintf("ABC"); getch(); textmode(C80); cprintf("ABC");
27、0; getch(); textmode(MONO); cprintf("ABC"); getch(); return 0; 函数名: textwidth 功 能: 返回以像素为单位的字符串宽度 用 法
28、: int far textwidth(char far *textstring); 程序例: #include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> int main(void) /* request&
29、#160;auto detection */ int gdriver = DETECT, gmode, errorcode; int x = 0, y = 0; int i; char msg80; /*
30、60;initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult()
31、; if (errorcode != grOk) /* an error occurred */ printf("Graphics error: %sn", grapherrormsg(errorcode);
32、60; printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ y
33、;= getmaxy() / 2; settextjustify(LEFT_TEXT, CENTER_TEXT); for (i=1; i<11; i+) /* select the text style, direction, an
34、d size */ settextstyle(TRIPLEX_FONT, HORIZ_DIR, i); /* create a message string */ sprintf(msg, "Size: %d",
35、60;i); /* output the message */ outtextxy(x, y, msg); /* advance to the end of the text */ &
36、#160; x += textwidth(msg); /* clean up */ getch(); closegraph(); return 0; 函数名: ti
37、me 功 能: 取一天的时间 用 法: logn time(long *tloc); 程序例: #include <time.h> #include <stdio.h> #include <dos.h> int main(void) time_t t;
38、60; t = time(NULL); printf("The number of seconds since January 1, 1970 is %ld",t); return 0; 函数名: tmpfile 功
39、 能: 以二进制方式打开暂存文件 用 法: FILE *tmpfile(void); 程序例: #include <stdio.h> #include <process.h> int main(void) FILE *tempfp; tempfp = tmpfile();
40、 if (tempfp) printf("Temporary file createdn"); else printf("Unable to create temporary filen"
41、); exit(1); return 0; 函数名: tmpnam 功 能: 创建一个唯一的文件名 用 法: char *tmpnam(char *sptr); 程序例:
42、160; #include <stdio.h> int main(void) char name13; tmpnam(name); printf("Temporary name: %sn", name); return 0; &
43、#160; 函数名: tolower 功 能: 把字符转换成小写字母 用 法: int tolower(int c); 程序例: #include <string.h> #include <stdio.h> #include <ctype.h> int main(void)
44、60; int length, i; char *string = "THIS IS A STRING" length = strlen(string); for (i=0; i<length; i+) stringi = tolower(stringi); printf("%sn
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年春季广东中山市东区艳阳学校教师招聘2人考试笔试备考题库及答案解析
- 2026年江西省港口集团有限公司校园招聘18人笔试考试备考题库及答案解析
- 2025下半年江苏无锡科技职业学院招聘高层次人才8人考试笔试备考试题及答案解析
- 2026年度陕西省选调生招录(面向北京大学)考试笔试参考题库附答案解析
- 2025年新能源行业储能技术应用与市场前景报告
- 《JBT10271-2001 数控机床直流主轴电动机通 用技术条件》(2026年)实施指南
- 2026年中储粮油脂有限公司招聘考试笔试模拟试题及答案解析
- 2025西北工业大学航空学院郗恒东团队非事业编科研助理招聘1人笔试考试参考题库及答案解析
- 《JBT9220.1-1999 铸造化铁炉酸性炉渣化学分析方法总则及一般规定》(2026年)实施指南
- 《JBT9168.8-1998 切削加工通 用工艺守则磨削》(2026年)实施指南
- 老年人进食照护课件
- 焊工证复审考试题及答案
- 统编版九年级上册语文期末复习:全册重点考点手册
- 烘焙主管述职报告
- 订单台帐管理培训
- 雨课堂学堂云在线《中国话剧名作鉴赏(大庆师院 )》单元测试考核答案
- 2025年AHA心肺复苏与心血管急救指南解读 2
- 小型自建房施工方案
- 2025-2026学年北师大版二年级上册数学第七单元测试卷及答案(三套)
- AI赋能小学教学:从课堂实践到效果提升
- 社区邻居聚会活动方案
评论
0/150
提交评论