⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fe.htm

📁 turbo c
💻 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>fe</TITLE></HEAD><BODY>函数名: ecvt<BR>功&nbsp; 能: 把一个浮点数转换为字符串<BR>用&nbsp; 法: char ecvt(double value, int ndigit, int *decpt, int *sign);<BR>程序例:<P>#include &lt;stdlib.h><BR>#include &lt;stdio.h><BR>#include &lt;conio.h><P>int main(void)<BR>{<BR>&nbsp;&nbsp; char *string;<BR>&nbsp;&nbsp; double value;<BR>&nbsp;&nbsp; int dec, sign;<BR>&nbsp;&nbsp; int ndig = 10;<P>&nbsp;&nbsp; clrscr();<BR>&nbsp;&nbsp; value = 9.876;<BR>&nbsp;&nbsp; string = ecvt(value, ndig, &amp;dec, &amp;sign);<BR>&nbsp;&nbsp; printf("string = %s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dec= %d \<BR>&nbsp;&nbsp; sign = %d\n", string, dec, sign);<P>&nbsp;&nbsp; value = -123.45;<BR>&nbsp;&nbsp; ndig= 15;<BR>&nbsp;&nbsp; string = ecvt(value,ndig,&amp;dec,&amp;sign);<BR>&nbsp;&nbsp; printf("string = %s dec = %d sign = %d\n",<BR>&nbsp;&nbsp; string, dec, sign);<BR>&nbsp;<P>&nbsp;&nbsp; value = 0.6789e5; /* scientific<BR>&nbsp;&nbsp; notation */<BR>&nbsp;&nbsp; ndig = 5;<BR>&nbsp;&nbsp; string = ecvt(value,ndig,&amp;dec,&amp;sign);<BR>&nbsp;&nbsp; printf("string = %s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dec = %d\<BR>&nbsp;&nbsp; sign = %d\n", string, dec, sign);<P>&nbsp;&nbsp; return 0;<BR>}<BR>&nbsp;<BR>&nbsp;<P>函数名: ellipse<BR>功&nbsp; 能: 画一椭圆<BR>用&nbsp; 法: void far ellipse(int x, int y, int stangle, int endangle,<BR>&nbsp;&nbsp;&nbsp; int xradius, int yradius);<BR>程序例:<P>#include &lt;graphics.h><BR>#include &lt;stdlib.h><BR>#include &lt;stdio.h><BR>#include &lt;conio.h><P>int main(void)<BR>{<BR>&nbsp;&nbsp; /* request auto detection */<BR>&nbsp;&nbsp; int gdriver = DETECT, gmode, errorcode;<BR>&nbsp;&nbsp; int midx, midy;<BR>&nbsp;&nbsp; int stangle = 0, endangle = 360;<BR>&nbsp;&nbsp; int xradius = 100, yradius = 50;<P>&nbsp;&nbsp; /* initialize graphics, local variables */<BR>&nbsp;&nbsp; initgraph(&amp;gdriver, &amp;gmode, "");<P>&nbsp;&nbsp; /* read result of initialization */<BR>&nbsp;&nbsp; errorcode = graphresult();<BR>&nbsp;&nbsp; if (errorcode != grOk)<BR>&nbsp;&nbsp; /* an error occurred */<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Graphics error: %s\n",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grapherrormsg(errorcode));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Press any key to halt:");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getch();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(1);<BR>&nbsp;&nbsp; /* terminate with an error code */<BR>&nbsp;&nbsp; }<P>&nbsp;&nbsp; midx = getmaxx() / 2;<BR>&nbsp;&nbsp; midy = getmaxy() / 2;<BR>&nbsp;&nbsp; setcolor(getmaxcolor());<P>&nbsp;&nbsp; /* draw ellipse */<BR>&nbsp;&nbsp; ellipse(midx, midy, stangle, endangle,<BR>&nbsp;&nbsp;&nbsp; xradius, yradius);<P>&nbsp;&nbsp; /* clean up */<BR>&nbsp;&nbsp; getch();<BR>&nbsp;&nbsp; closegraph();<BR>&nbsp;&nbsp; return 0;<BR>}<BR>&nbsp;<BR>&nbsp;<P>函数名: enable<BR>功&nbsp; 能: 开放硬件中断<BR>用&nbsp; 法: void enable(void);<BR>程序例:<P>/* ** NOTE:<BR>This is an interrupt service routine. You can NOT compile this program<BR>with Test Stack Overflow turned on and get an executable file whichwill<BR>operate correctly.<BR>*/<P>#include &lt;stdio.h><BR>#include &lt;dos.h><BR>#include &lt;conio.h><P>/* The clock tick interrupt */<BR>#define INTR 0X1C<P>void interrupt ( *oldhandler)(void);<P>int count=0;<P>void interrupt handler(void)<BR>{<BR>/*<BR>&nbsp;&nbsp; disable interrupts during the handling of the interrupt<BR>*/<BR>&nbsp;&nbsp; disable();<BR>/* increase the global counter */<BR>&nbsp;&nbsp; count++;<BR>/*<BR>&nbsp;&nbsp; re enable interrupts at the end of the handler<BR>*/<BR>&nbsp;&nbsp; enable();<BR>/* call the old routine */<BR>&nbsp;&nbsp; oldhandler();<BR>}<P>int main(void)<BR>{<BR>/* save the old interrupt vector */<BR>&nbsp;&nbsp; oldhandler = getvect(INTR);<P>/* install the new interrupt handler */<BR>&nbsp;&nbsp; setvect(INTR, handler);<P>/* loop until the counter exceeds 20 */<BR>&nbsp;&nbsp; while (count &lt; 20)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("count is %d\n",count);<P>/* reset the old interrupt handler */<BR>&nbsp;&nbsp; setvect(INTR, oldhandler);<P>&nbsp;&nbsp; return 0;<BR>}<BR>&nbsp;<BR>&nbsp;<P>函数名: eof<BR>功&nbsp; 能: 检测文件结束<BR>用&nbsp; 法: int eof(int *handle);<BR>程序例:<P>#include &lt;sys\stat.h><BR>#include &lt;string.h><BR>#include &lt;stdio.h><BR>#include &lt;fcntl.h><BR>#include &lt;io.h><P>int main(void)<BR>{<BR>&nbsp;&nbsp; int handle;<BR>&nbsp;&nbsp; char msg[] = "This is a test";<BR>&nbsp;&nbsp; char ch;<P>&nbsp;&nbsp; /* create a file */<BR>&nbsp;&nbsp; handle = open("DUMMY.FIL",<BR>&nbsp;&nbsp; O_CREAT | O_RDWR,<BR>&nbsp;&nbsp; S_IREAD | S_IWRITE);<P>&nbsp;&nbsp; /* write some data to the file */<BR>&nbsp;&nbsp; write(handle, msg, strlen(msg));<P>&nbsp;&nbsp; /* seek to the beginning of the file */<BR>&nbsp;&nbsp; lseek(handle, 0L, SEEK_SET);<P>&nbsp;&nbsp; /*<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reads chars from the file until hitEOF<BR>&nbsp;&nbsp; */<BR>&nbsp;&nbsp; do<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; read(handle, &amp;ch, 1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("%c", ch);<BR>&nbsp;&nbsp; } while (!eof(handle));<P>&nbsp;&nbsp; close(handle);<BR>&nbsp;&nbsp; return 0;<BR>}<BR>&nbsp;<BR>&nbsp;<P>函数名: exec...<BR>功&nbsp; 能: 装入并运行其它程序的函数<BR>用&nbsp; 法: int execl(char *pathname, char *arg0, arg1, ..., argn,NULL);<BR>&nbsp;int execle(char *pathname, char *arg0, arg1, ..., argn, NULL,<BR>&nbsp;&nbsp;&nbsp;&nbsp; char *envp[]);<BR>&nbsp;int execlp(char *pathname, char *arg0, arg1, .., NULL);<BR>&nbsp;int execple(char *pathname, char *arg0, arg1, ..., NULL,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *envp[]);<BR>&nbsp;int execv(char *pathname, char *argv[]);<BR>&nbsp;int execve(char *pathname, char *argv[], char *envp[]);<BR>&nbsp;int execvp(char *pathname, char *argv[]);<BR>&nbsp;int execvpe(char *pathname, char *argv[], char *envp[]);<BR>程序例:<P>/* execv example */<BR>#include &lt;process.h><BR>#include &lt;stdio.h><BR>#include &lt;errno.h><P>void main(int argc, char *argv[])<BR>{<BR>&nbsp;&nbsp; int i;<P>&nbsp;&nbsp; printf("Command line arguments:\n");<BR>&nbsp;&nbsp; for (i=0; i&lt;argc; i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("[%2d] : %s\n", i, argv[i]);<P>&nbsp;&nbsp; printf("About to exec child with arg1 arg2 ...\n");<BR>&nbsp;&nbsp; execv("CHILD.EXE", argv);<P>&nbsp;&nbsp; perror("exec error");<P>&nbsp;&nbsp; exit(1);<BR>}<BR>&nbsp;<BR>&nbsp;<P>函数名: exit<BR>功&nbsp; 能: 终止程序<BR>用&nbsp; 法: void exit(int status);<BR>程序例:<P>#include &lt;stdlib.h><BR>#include &lt;conio.h><BR>#include &lt;stdio.h><P>int main(void)<BR>{<BR>&nbsp;&nbsp; int status;<P>&nbsp;&nbsp; printf("Enter either 1 or 2\n");<BR>&nbsp;&nbsp; status = getch();<BR>&nbsp;&nbsp; /* Sets DOS errorlevel&nbsp; */<BR>&nbsp;&nbsp; exit(status - '0');<P>/* Note: this line is never reached */<BR>&nbsp;&nbsp; return 0;<BR>}<BR>&nbsp;<BR>&nbsp;<P>函数名: exp<BR>功&nbsp; 能: 指数函数<BR>用&nbsp; 法: double exp(double x);<BR>程序例:<P>#include &lt;stdio.h><BR>#include &lt;math.h><P>int main(void)<BR>{<BR>&nbsp;&nbsp; double result;<BR>&nbsp;&nbsp; double x = 4.0;<P>&nbsp;&nbsp; result = exp(x);<BR>&nbsp;&nbsp; printf("'e' raised to the power \<BR>&nbsp;&nbsp; of %lf (e ^ %lf) = %lf\n",<BR>&nbsp;&nbsp; x, x, result);<P>&nbsp;&nbsp; return 0;<BR>}<BR>&nbsp;<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="index.html">返回目录</A><BR>&nbsp;</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -