




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、函數(shù)大全(t開頭)函數(shù)名: tan 功 能: 正切函數(shù) 用 法: 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; 函數(shù)名: tanh
3、 功 能: 雙曲正切函數(shù) 用 法: 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; 函數(shù)名: t
5、ell 功 能: 取文件指針的當(dāng)前位置 用 法: 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; 函數(shù)名: textattr 功 能: 設(shè)置文本屬性 用 法: 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; 函數(shù)名: 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; 函數(shù)名: 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; 函數(shù)名: 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; 函數(shù)名: textmode 功 能: 將屏幕設(shè)置成文本模式 用
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; 函數(shù)名: 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; 函數(shù)名: ti
37、me 功 能: 取一天的時(shí)間 用 法: 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; 函數(shù)名: tmpfile 功
39、 能: 以二進(jìn)制方式打開暫存文件 用 法: 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; 函數(shù)名: tmpnam 功 能: 創(chuàng)建一個(gè)唯一的文件名 用 法: 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; 函數(shù)名: tolower 功 能: 把字符轉(zhuǎn)換成小寫字母 用 法: 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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 泉州復(fù)工復(fù)產(chǎn)活動(dòng)方案
- 武都區(qū)文聯(lián)活動(dòng)方案
- 模板美容活動(dòng)策劃方案
- 民調(diào)宣傳活動(dòng)方案
- 梅山武術(shù)進(jìn)校園活動(dòng)方案
- 氣球守夜活動(dòng)方案
- 檳榔特價(jià)活動(dòng)方案
- 江湖俱樂部活動(dòng)方案
- 武漢公司春游活動(dòng)方案
- 母子工程活動(dòng)方案
- 垃圾爐渣廠管理制度
- 2025安全生產(chǎn)月一把手講安全公開課主題宣講三十三(60P)
- 2025至2030中國二甲醚汽車行業(yè)市場分析及競爭形勢與發(fā)展前景預(yù)測報(bào)告
- 統(tǒng)編版七年級(jí)歷史上冊(cè)期末復(fù)習(xí)課件
- 2025春季學(xué)期國開電大本科《人文英語4》一平臺(tái)機(jī)考真題及答案(第五套)
- 2025至2030中國匹克球市場前景預(yù)判與未來發(fā)展形勢分析報(bào)告
- 2025三明市三元區(qū)輔警考試試卷真題
- 新生兒高膽紅素血癥護(hù)理措施
- 防護(hù)窗拆除合同范本
- 關(guān)于問責(zé)的工作報(bào)告
- 2025春季學(xué)期國開電大??啤吨屑?jí)財(cái)務(wù)會(huì)計(jì)(二)》一平臺(tái)在線形考(第二次形考任務(wù))試題及答案
評(píng)論
0/150
提交評(píng)論