📄 fp.htm
字号:
value); <br>
程序例: </p>
<p>#include <dos.h> <br>
#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
clrscr(); <br>
cprintf("Make sure the scroll lock key
is off and press any key\r\n"); <br>
getch(); <br>
pokeb(0x0000,0x0417,16); <br>
cprintf("The scroll lock is now
on\r\n"); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: poly <br>
功 能: 根据参数产生一个多项式 <br>
用 法: double poly(double x, int n, double c[]); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <math.h> </p>
<p>/* polynomial: x**3 - 2x**2 + 5x - 1 */ </p>
<p>int main(void) <br>
{ <br>
double array[] = { -1.0, 5.0, -2.0, 1.0 }; <br>
double result; </p>
<p> result = poly(2.0, 3, array); <br>
printf("The polynomial: x**3 - 2.0x**2
+ 5x - 1 at 2.0 is %lf\n", <br>
result); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: pow <br>
功 能: 指数函数(x的y次方) <br>
用 法: double pow(double x, double y); <br>
程序例: </p>
<p>#include <math.h> <br>
#include <stdio.h> </p>
<p>int main(void) <br>
{ <br>
double x = 2.0, y = 3.0; </p>
<p> printf("%lf raised to %lf is
%lf\n", x, y, pow(x, y)); <br>
return 0; <br>
} <br>
</p>
<p>函数名: pow10 <br>
功 能: 指数函数(10的p次方) <br>
用 法: double pow10(int p); <br>
程序例: </p>
<p>#include <math.h> <br>
#include <stdio.h> </p>
<p>int main(void) <br>
{ <br>
double p = 3.0; </p>
<p> printf("Ten raised to %lf is
%lf\n", p, pow10(p)); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: printf <br>
功 能: 产生格式化输出的函数 <br>
用 法: int printf(char *format...); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <string.h> </p>
<p>#define I 555 <br>
#define R 5.5 </p>
<p>int main(void) <br>
{ <br>
int i,j,k,l; <br>
char buf[7]; <br>
char *prefix = buf; <br>
char tp[20]; <br>
printf("prefix 6d
6o 8x
10.2e " <br>
"10.2f\n"); <br>
strcpy(prefix,"%"); <br>
for (i = 0; i < 2; i++) <br>
{ <br>
for (j = 0; j < 2; j++)
<br>
for (k =
0; k < 2; k++) <br>
for (l = 0; l < 2; l++) <br>
{ <br>
if (i==0) strcat(prefix,"-"); <br>
if (j==0) strcat(prefix,"+"); <br>
if (k==0) strcat(prefix,"#"); <br>
if (l==0) strcat(prefix,"0"); <br>
printf("%5s |",prefix); <br>
strcpy(tp,prefix); <br>
strcat(tp,"6d |"); <br>
printf(tp,I); <br>
strcpy(tp,""); <br>
strcpy(tp,prefix); <br>
strcat(tp,"6o |"); <br>
printf(tp,I); <br>
strcpy(tp,""); <br>
strcpy(tp,prefix); <br>
strcat(tp,"8x |"); <br>
printf(tp,I); <br>
strcpy(tp,""); <br>
strcpy(tp,prefix); <br>
strcat(tp,"10.2e |"); <br>
printf(tp,R); <br>
strcpy(tp,prefix); <br>
strcat(tp,"10.2f |"); <br>
printf(tp,R); <br>
printf("
\n"); <br>
strcpy(prefix,"%"); <br>
} <br>
} <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: putc <br>
功 能: 输出一字符到指定流中 <br>
用 法: int putc(int ch, FILE *stream); <br>
程序例: </p>
<p>#include <stdio.h> </p>
<p>int main(void) <br>
{ <br>
char msg[] = "Hello world\n"; <br>
int i = 0; </p>
<p> while (msg[i]) <br>
putc(msg[i++], stdout); <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: putch <br>
功 能: 输出字符到控制台 <br>
用 法: int putch(int ch); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
char ch = 0; </p>
<p> printf("Input a string:"); <br>
while ((ch != '\r')) <br>
{ <br>
ch = getch(); <br>
putch(ch); <br>
} <br>
return 0; <br>
} <br>
<br>
</p>
<p>函数名: putchar <br>
功 能: 在stdout上输出字符 <br>
用 法: int putchar(int ch); <br>
程序例: </p>
<p>#include <stdio.h> </p>
<p>/* define some box-drawing characters */ <br>
#define LEFT_TOP 0xDA <br>
#define RIGHT_TOP 0xBF <br>
#define HORIZ 0xC4 <br>
#define VERT 0xB3 <br>
#define LEFT_BOT 0xC0 <br>
#define RIGHT_BOT 0xD9 </p>
<p>int main(void) <br>
{ <br>
char i, j; </p>
<p> /* draw the top of the box */ <br>
putchar(LEFT_TOP); <br>
for (i=0; i<10; i++) <br>
putchar(HORIZ); <br>
putchar(RIGHT_TOP); <br>
putchar('\n'); </p>
<p> /* draw the middle */ <br>
for (i=0; i<4; i++) <br>
{ <br>
putchar(VERT); <br>
for (j=0; j<10; j++) <br>
putchar(' '); <br>
putchar(VERT); <br>
putchar('\n'); <br>
} </p>
<p> /* draw the bottom */ <br>
putchar(LEFT_BOT); <br>
for (i=0; i<10; i++) <br>
putchar(HORIZ); <br>
putchar(RIGHT_BOT); <br>
putchar('\n'); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: putenv <br>
功 能: 把字符串加到当前环境中 <br>
用 法: int putenv(char *envvar); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <stdlib.h> <br>
#include <alloc.h> <br>
#include <string.h> <br>
#include <dos.h> </p>
<p>int main(void) <br>
{ <br>
char *path, *ptr; <br>
int i = 0; </p>
<p> /* get the current path environment */ <br>
ptr = getenv("PATH"); </p>
<p> /* set up new path */ <br>
path = malloc(strlen(ptr)+15); <br>
strcpy(path,"PATH="); <br>
strcat(path,ptr); <br>
strcat(path,";c:\\temp"); </p>
<p> /* replace the current path and display
current environment */ <br>
putenv(path); <br>
while (environ[i]) <br>
printf("%s\n",environ[i++]); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: putimage <br>
功 能: 在屏幕上输出一个位图 <br>
用 法: void far putimage(int x, int y, void far
*bitmap, int op); <br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -