?? ft.htm
字號:
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<META NAME="Author" CONTENT="wdg">
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (Win95; I) [Netscape]">
<TITLE>ft</TITLE>
</HEAD>
<BODY bgcolor="#CCCCCC" text="#003399">
<P>函數名: tan
<BR>功 能: 正切函數
<BR>用 法: double tan(double x);
<BR>程序例:
<P>#include <stdio.h>
<BR>#include <math.h>
<P>int main(void)
<BR>{
<BR> double result, x;
<P> x = 0.5;
<BR> result = tan(x);
<BR> printf("The tan of %lf is %lf\n", x, result);
<BR> return 0;
<BR>}
<BR>
<BR>
<BR>
<P>函數名: tanh
<BR>功 能: 雙曲正切函數
<BR>用 法: double tanh(double x);
<BR>程序例:
<P>#include <stdio.h>
<BR>#include <math.h>
<P>int main(void)
<BR>{
<BR> double result, x;
<P> x = 0.5;
<BR> result = tanh(x);
<BR> printf("The hyperbolic tangent of %lf is %lf\n", x, result);
<BR> return 0;
<BR>}
<BR>
<BR>
<BR>
<BR>
<P>函數名: tell
<BR>功 能: 取文件指針的當前位置
<BR>用 法: long tell(int handle);
<BR>程序例:
<P>#include <string.h>
<BR>#include <stdio.h>
<BR>#include <fcntl.h>
<BR>#include <io.h>
<P>int main(void)
<BR>{
<BR> int handle;
<BR> char msg[] = "Hello world";
<P> if ((handle = open("TEST.$$$", O_CREAT | O_TEXT | O_APPEND))
== -1)
<BR> {
<BR> perror("Error:");
<BR> return 1;
<BR> }
<BR> write(handle, msg, strlen(msg));
<BR> printf("The file pointer is at byte %ld\n", tell(handle));
<BR> close(handle);
<BR> return 0;
<BR>}
<BR>
<BR>
<BR>
<BR>
<P>函數名: textattr
<BR>功 能: 設置文本屬性
<BR>用 法: void textattr(int attribute);
<BR>程序例:
<P>#include <conio.h>
<P>int main(void)
<BR>{
<BR> int i;
<P> clrscr();
<BR> for (i=0; i<9; i++)
<BR> {
<BR> textattr(i + ((i+1) << 4));
<BR> cprintf("This is a test\r\n");
<BR> }
<P> return 0;
<BR>}
<BR>
<BR>
<BR>
<P>函數名: textbackground
<BR>功 能: 選擇新的文本背景顏色
<BR>用 法: void textbackground(int color);
<BR>程序例:
<P>#include <conio.h>
<P>int main(void)
<BR>{
<BR> int i, j;
<P> clrscr();
<BR> for (i=0; i<9; i++)
<BR> {
<BR> for (j=0; j<80; j++)
<BR> cprintf("C");
<BR> cprintf("\r\n");
<BR> textcolor(i+1);
<BR> textbackground(i);
<BR> }
<P> return 0;
<BR>}
<BR>
<BR>
<BR>
<P>函數名: textcolor
<BR>功 能: 在文本模式中選擇新的字符顏色
<BR>用 法: void textcolor(int color);
<BR>程序例:
<BR>#include <conio.h>
<P>int main(void)
<BR>{
<BR> int i;
<P> for (i=0; i<15; i++)
<BR> {
<BR> textcolor(i);
<BR> cprintf("Foreground Color\r\n");
<BR> }
<P> return 0;
<BR>}
<BR>
<BR>
<BR>
<P>函數名: textheight
<BR>功 能: 返回以像素為單位的字符串高度
<BR>用 法: int far textheight(char far *textstring);
<BR>程序例:
<P>#include <graphics.h>
<BR>#include <stdlib.h>
<BR>#include <stdio.h>
<BR>#include <conio.h>
<P>int main(void)
<BR>{
<BR> /* request auto detection */
<BR> int gdriver = DETECT, gmode, errorcode;
<BR> int y = 0;
<BR> int i;
<BR> char msg[80];
<P> /* initialize graphics and local variables */
<BR> initgraph(&gdriver, &gmode, "");
<P> /* read result of initialization */
<BR> errorcode = graphresult();
<BR> if (errorcode != grOk) /* an error occurred */
<BR> {
<BR> printf("Graphics error: %s\n", grapherrormsg(errorcode));
<BR> printf("Press any key to halt:");
<BR> getch();
<BR> exit(1); /* terminate with an error
code */
<BR> }
<P> /* draw some text on the screen */
<BR> for (i=1; i<11; i++)
<BR> {
<BR> /* select the text style, direction,
and size */
<BR> settextstyle(TRIPLEX_FONT, HORIZ_DIR,
i);
<P> /* create a message string */
<BR> sprintf(msg, "Size: %d", i);
<P> /* output the message */
<BR> outtextxy(1, y, msg);
<P> /* advance to the next text line */
<BR> y += textheight(msg);
<BR> }
<P> /* clean up */
<BR> getch();
<BR> closegraph();
<BR> return 0;
<BR>}
<BR>
<BR>
<BR>
<P>函數名: textmode
<BR>功 能: 將屏幕設置成文本模式
<BR>用 法: void textmode(int mode);
<BR>程序例:
<P>#include <conio.h>
<P>int main(void)
<BR>{
<BR> textmode(BW40);
<BR> cprintf("ABC");
<BR> getch();
<P> textmode(C40);
<BR> cprintf("ABC");
<BR> getch();
<P> textmode(BW80);
<BR> cprintf("ABC");
<BR> getch();
<P> textmode(C80);
<BR> cprintf("ABC");
<BR> getch();
<P> textmode(MONO);
<BR> cprintf("ABC");
<BR> getch();
<P> return 0;
<BR>}
<BR>
<BR>
<P>函數名: textwidth
<BR>功 能: 返回以像素為單位的字符串寬度
<BR>用 法: int far textwidth(char far *textstring);
<BR>程序例:
<P>#include <graphics.h>
<BR>#include <stdlib.h>
<BR>#include <stdio.h>
<BR>#include <conio.h>
<P>int main(void)
<BR>{
<BR> /* request auto detection */
<BR> int gdriver = DETECT, gmode, errorcode;
<BR> int x = 0, y = 0;
<BR> int i;
<BR> char msg[80];
<P> /* initialize graphics and local variables */
<BR> initgraph(&gdriver, &gmode, "");
<P> /* read result of initialization */
<BR> errorcode = graphresult();
<BR> if (errorcode != grOk) /* an error occurred */
<BR> {
<BR> printf("Graphics error: %s\n", grapherrormsg(errorcode));
<BR> printf("Press any key to halt:");
<BR> getch();
<BR> exit(1); /* terminate with an error
code */
<BR> }
<P> y = getmaxy() / 2;
<P> settextjustify(LEFT_TEXT, CENTER_TEXT);
<BR> for (i=1; i<11; i++)
<BR> {
<BR> /* select the text style, direction,
and size */
<BR> settextstyle(TRIPLEX_FONT, HORIZ_DIR,
i);
<P> /* create a message string */
<BR> sprintf(msg, "Size: %d", i);
<P> /* output the message */
<BR> outtextxy(x, y, msg);
<P> /* advance to the end of the text */
<BR> x += textwidth(msg);
<BR> }
<P> /* clean up */
<BR> getch();
<BR> closegraph();
<BR> return 0;
<BR>}
<BR>
<BR>
<P>函數名: time
<BR>功 能: 取一天的時間
<BR>用 法: logn time(long *tloc);
<BR>程序例:
<P>#include <time.h>
<BR>#include <stdio.h>
<BR>#include <dos.h>
<P>int main(void)
<BR>{
<BR> time_t t;
<P> t = time(NULL);
<BR> printf("The number of seconds since January 1, 1970 is
%ld",t);
<BR> return 0;
<BR>}
<BR>
<BR>
<BR>
<P>函數名: tmpfile
<BR>功 能: 以二進制方式打開暫存文件
<BR>用 法: FILE *tmpfile(void);
<BR>程序例:
<P>#include <stdio.h>
<BR>#include <process.h>
<P>int main(void)
<BR>{
<BR> FILE *tempfp;
<P> tempfp = tmpfile();
<BR> if (tempfp)
<BR> printf("Temporary file created\n");
<BR> else
<BR> {
<BR> printf("Unable to create temporary file\n");
<BR> exit(1);
<BR> }
<P> return 0;
<BR>}
<BR>
<BR>
<BR>
<P>函數名: tmpnam
<BR>功 能: 創建一個唯一的文件名
<BR>用 法: char *tmpnam(char *sptr);
<BR>程序例:
<P>#include <stdio.h>
<P>int main(void)
<BR>{
<BR> char name[13];
<P> tmpnam(name);
<BR> printf("Temporary name: %s\n", name);
<BR> return 0;
<BR>}
<BR>
<BR>
<BR>
<P>函數名: tolower
<BR>功 能: 把字符轉換成小寫字母
<BR>用 法: int tolower(int c);
<BR>程序例:
<P>#include <string.h>
<BR>#include <stdio.h>
<BR>#include <ctype.h>
<P>int main(void)
<BR>{
<BR> int length, i;
<BR> char *string = "THIS IS A STRING";
<P> length = strlen(string);
<BR> for (i=0; i<length; i++)
<BR> {
<BR> string[i] = tolower(string[i]);
<BR> }
<BR> printf("%s\n",string);
<P> return 0;
<BR>}
<BR>
<BR>
<P>函數名: toupper
<BR>功 能: 把字符轉換成大寫字母
<BR>用 法: int toupper(int c);
<BR>程序例:
<P>#include <string.h>
<BR>#include <stdio.h>
<BR>#include <ctype.h>
<P>int main(void)
<BR>{
<BR> int length, i;
<BR> char *string = "this is a string";
<P> length = strlen(string);
<BR> for (i=0; i<length; i++)
<BR> {
<BR> string[i] = toupper(string[i]);
<BR> }
<P> printf("%s\n",string);
<P> return 0;
<BR>}
<BR>
<BR>
<P>函數名: tzset
<BR>功 能: UNIX時間兼容函數
<BR>用 法: void tzset(void);
<BR>程序例:
<P>#include <time.h>
<BR>#include <stdlib.h>
<BR>#include <stdio.h>
<P>int main(void)
<BR>{
<BR> time_t td;
<P> putenv("TZ=PST8PDT");
<BR> tzset();
<BR> time(&td);
<BR> printf("Current time = %s\n", asctime(localtime(&td)));
<BR> return 0;
<BR>}
<BR>
<P>
<A HREF="cyyhsdq.htm">返回</A>
<P>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -