ImageVerifierCode 换一换
格式:DOCX , 页数:19 ,大小:18.76KB ,
资源ID:26519502      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/26519502.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C语言函数大全p开头docx.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C语言函数大全p开头docx.docx

1、C语言函数大全p开头docx函数大全(p开头)61函数名:parsfnm功能:分析文件名用 法:char *parsfnm (char *cmdline, struct fcb *fcbptr, int option); 程序例:#include #include #include #include int main(void)char line80;struct fcb blk;/* get file name */printf(MEnter drive and file name (no path - ie. a:file.dat)nM); gets(line);/* put file n

2、ame in fcb */if (parsfnm(line, &blk, 1) = NULL)printf(MError in parsfm callnH);elseprintf(Drive #%d Name: %1 lsn, blk.fcb_drive, blk.fcb_name);return 0;函数名:peek功能:检查存储单元用 法:int peek(int segment, unsigned offset); 程序例:#include #include #include int main(void)int value = 0;prinif(=The current sUHus of

3、 your keyboard is,n=); value H Peek(oxoo4p0x0017)八 if (value 1)PS-二 f(-Right shift onm=)八elseprintaRight shift 05n=)八if (value 2)primf(=Lefr shift onvr.relseprin-fTLen shift O51T);if (value &. 4) printf(=con=rol key onn=)_elseprin.s=co=ro】 key offn=)八if (valueRp8)printf(=Alr key onn=)一elseprins-t ke

4、y 03=)if (vace 8l 16) prinf(=scro=ock 02n=relse primf(=scro=ock offn=);if (vace 8c 32) primf(=Num lock onn=);else prinif(=Numock offn=);if (vace 8l 64)primacaps lock onw);elseprimf(二capsock 03=)rerun-p因磬Ik【peekb功能:检查存储单元用 法:char peekb (int segment, unsigned offset); 程序例:#include #include #include in

5、t main(void)int value = 0;printf(The current status of your keyboard is:n); value = peekb(0x0040, 0x0017);if (value & 1)printf(Right shift onn);elseprintf(MRight shift offnM);if (value & 2)printf(Left shift onn);elseprintf(Left shift offnH);if (value & 4)printf(Control key onnH);elseprintf(Control k

6、ey offn);if (value & 8)printf(Alt key onn);elseprintf(Alt key oflAn);if (value & 16)printf(Scroll lock onnu);elseprintfCScroll lock offn,f);if (value & 32)printfCNum lock onnu);elseprintf(Num lock offnu);if (value & 64) printfCCaps lock onn);elseprintf(HCaps lock offn);return 0;函数名:perror功能:系统错误信息用

7、法:void perror(char string);程序例:#include int main(void)FILE *fp;fp = fopen(peiTor.dat r);perror(HUnable to open file for reading0); return 0;函数名:pieslice功能:绘制并填充一个扇形用 法:void far pieslice(int x, int stanle, int endangle, int radius); 程序例:#include #include #include #include int main(void)/* request aut

8、o detection */int gdriver = DETECT, gmode, errorcode;int midx, midy;int stangle = 45, endangle = 135, radius = 100;/* initialize graphics and local variables */ initgraph(&gdriver, &gmode,HH);/* read result of initialization */errorcode = graphresult();if (errorcode != grOk) /* an error occurred */p

9、rintf(HGraphics error: %snH, grapheiTormsg(errorcode); printf(nPress any key to halt:H);getch();exit(l); /* terminate with an error code */midx = getmaxx() / 2; midy = getmaxy() / 2;/* set fill style and draw a pie slice */ setfillstyle(EMPTY_FILL, getmaxcolor(); pieslice(midx, midy, stangle, endang

10、le, radius);/* clean up */ getch(); closegraph(); return 0;函数名:poke功能:存值到一个给定存储单元用 法:void poke(int segment, int offset, int value);程序例:#include #include int main(void)clrscr();cprintf(nMake sure the scroll lock key is off and press any keyrnH); getch();poke(0x0000,0x0417,16);cprintf(nThe scroll lock

11、 is now onrnH); return 0;函数名:pokeb功能:存值到一个给定存储单元用 法:void pokeb(int segment, int offset, char value);程序例:#include #include int main(void)clrscr();cprintf(HMake sure the scroll lock key is off and press any keyrnH); getch();pokeb(0x0000,0x0417,16);cprintf(nThe scroll lock is now onrnM);return 0;函数名:po

12、ly功能:根据参数产生一个多项式用 法:double poly(double x, int n, double cJ);程序例:#include #include /* polynomial: x*3 2x*2 + 5x 1 */int main(void)double array = -1.0, 5.0, -2.0, 1.0 ;double result;result = poly(2.0, 3, array);printf(The polynomial: x*3 - 2.0x*2 + 5x - 1 at 2.0 is %lfn, result);return 0;函数名:pow功 能:指数

13、函数(x的y次方)用 法:double pow(double x, double y);程序例:#include #include int main(void)double x = 2.0, y = 3.0;printf(%lf raised to %lf is x, y, pow(x, y);return 0;函数名:pow 10功能:指数函数(10的p次方) 用 法:double powl0(int p);程序例:#include #inelude int main(void)double p = 3.0;printf(MTen raised to %lf is %lfnH, p, pow

14、lO(p); return 0;函数名:printf功能:产生格式化输出的函数 用 法:int printf(char *format); 程序例:#include #include #define I 555#define R 5.5int main(void)int i,j,k,l;char buf71;char prefix = buf;char tp20;printf(Mprefix 6d 60 8x 10.2e”10.22”);strcpy(prefix,%n);for (i = 0; i 2; i+)for(j = 0;j2;j+)for (k = 0; k 2; k+)for (

15、1 = 0; 1 2; 1+)if (i=0) strcat(prefix,H-H);讦(j=0) strcat(prefix,H+n);if (k=0) strcat(prefix,*#);if (l=0) strcat(prefix,HOM); printf(%5s |u,prefix); strcpy(tp,prefix);strcat(tp/6d printf(tp,I); strcpy(tp;M,);strcpy(tp,prefix);strcat(tp;6o |H); printf(tp,I);strcpy(tp;n,); strcpy(tp,prefix);strcat(tp,8

16、x printf(tp,I);strcpy(tp;,H); strcpy(tp,prefix);strcat(tp,10.2e printf(tp,R);strcpy(tp,prefix);strcat(tp,”10.2iT);printf(tp,R); printfC nH); strcpy(prefix/%);)return 0;函数名:putc功能:输出一字符到指定流中用 法:int putc(int ch, FILE * stream); 程序例:#include int main(void)char msg = MHello worldnH;int i = 0;while (msgi

17、)putc(msgi+, stdout);return 0;函数名:putch功能:输出字符到控制台 用 法:int putch(int ch);程序例:#include #include int main(void)char ch = 0;printf(MInput a string:”); while (ch != V) ch = getch(); putch(ch);return 0;函数名:putchar功能:在stdout 输出字符用 法:int putchar(int ch);程序例:#include /* define some box-drawing characters */

18、#define LEFT_TOP OxDA#define RIGHT_TOP OxBF#define HORIZ 0xC4#define VERT 0xB3#define LEFT.BOT OxCO#define RIGHT.BOT 0xD9int main(void)char i, j;/* draw the top of the box */ putchar(LEFT_TOP);for (i=0; i10; i+)putchar(HORIZ);putchar(RIGHT_TOP); putcharCn);/* draw the middle */for (i=0; i4; i+)putch

19、ar(VERT); for(j=0;j10;j+)putchar();putchar(VERT);putchar(n);/* draw the bottom */ putchar(LEFT_BOT); for (i=0; i10; i+) putchar(HORIZ);putchar(RIGHT_BOT); putchar(n);return 0;函数名:putenv功能:把字符串加到当前环境中用 法:int putenv(char *envvar);程序例:#include #include #include #include #include int main(void)char *pat

20、h, *ptr;int i = 0;/* get the current path envionment */ptr = getenv(PATHM);/* set up new path /path = malloc(strlen(ptr)+15);strcpy(path,MPATH=M);strcat(path,ptr);strcat(path/,;c:tempu);/* replace the current path and display current environment */ putenv(path);while (environi)printf(%sn,environfi+)

21、;return 0;函数名:put image功能:在屏幕上输出一个位图用 了去:void far putimage(int x, int y, void far bitmap, int op); 程序例:#inelude #include #include #include #define ARROW_S1ZE 10 void draw_arrow(int x, int y);int main(void)/* request autodetection */int gdriver = DETECT, gmode, errorcode;void * arrow;int x, y, maxx;u

22、nsigned int size;/* initialize graphics and local variables */initgraph(&gdrivei &gmode,HU);/* read result of initialization */errorcode = graphresult();if (errorcode != grOk) /* an error occurred */printf(nGraphics error: %snM, grapheiTormsg(errorcode); printf(HPress any key to halt:”);getch();exit

23、(l); /* terminate with an error code */maxx = getmaxx();x = 0;y = getmaxyO / 2;/* draw the image to be grabbed */draw_arrow(x, y);/* calculate the size of the image */size = imagesize(x, y-ARROW_SIZE, x+(4*ARR0W_SIZE), y+ARROW_SIZE);/* allocate memory to hold the image */arrow = malloc(size);/* grab

24、 the image */getimage(x, y-ARROW_SIZE, x+(4*ARROW_SIZE), y+ARROW_SIZE, arrow);/* repeat until a key is pressed */while (!kbhit()/* erase old image */putimage(x, y-ARROW_SIZE, arrow, XOR_PUT);x += ARROW_SIZE;if (x = maxx)x = 0;/* plot new image */putimage(x, y-ARROW_SIZE, arrow, XOR_PUT);/* clean up

25、*/ free(aiTow); closegraph(); return 0;void draw_arrow(int x, int y)/* draw an arrow on the screen */ moveto(x, y);linerel(4*ARROW_SIZE, 0);linerel(-2*ARROW_SIZE, -1 *ARROW_SIZE); linereKO, 2*ARROW_SIZE);linerel(2*ARROW_SIZE, -1 *ARROW_SIZE);函数名:putpixel功能:在指定位置画一像素 用 法:void far putpixel (int x, int

26、 y, int pixelcolor); 程序例:#inelude #include #include #include #include #define PIXEL_COUNT 1000#define DELAY TIME 100 /* in milliseconds */ int main(void)/* request autodetection */int gdriver = DETECT, gmode, errorcode;int i, x, y, color, maxx, maxy, maxcolor, seed;/* initialize graphics and local v

27、ariables */initgraph(&gdriver, &gmode,HU);/* read result of initialization */errorcode = graphresult();if (errorcode != grOk) /* an error occurred */printf(nGraphics error: %sn grapheiTormsg(errorcode); printf(HPress any key to halt:11);getch();exit(l); /* terminate with an error code */maxx = getma

28、xx() + 1;maxy = getmaxy() + 1;maxcolor = getmaxcolor() + 1;while (!kbhit()/* seed the random number generator */seed = ran dom(32767);srand(seed);for (i=0; iPIXEL_COUNT; i+)x = random(maxx);y = ran dom(niaxy);color = random(maxcolor); putpixel(x, y, color);delay(DELAY_TIME); srand(seed);for (i=0; iPIXEL_COUNT; i+) x = ran dom(maxx);y = random(maxy);color = random(maxcolor);if (color = getpixel(x, y) putpixel(x, y, 0);/* clean up */ getch(); closegraph(); return 0;函数名:puts功能:送一字符串

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1