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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

C语言函数大全G篇.docx

1、C语言函数大全G篇G:函数名: gcvt功 能: 把浮点数转换成字符串用 法: char *gcvt(double value, int ndigit, char *buf);程序例: #include #include int main(void) char str25; double num; int sig = 5; /* significant digits */ /* a regular number */ num = 9.876; gcvt(num, sig, str); printf(string = %sn, str); /* a negative number */ num

2、= -123.4567; gcvt(num, sig, str); printf(string = %sn, str); /* scientific notation */ num = 0.678e5; gcvt(num, sig, str); printf(string = %sn, str); return(0);函数名: geninterrupt功 能: 产生一个软中断用 法: void geninterrupt(int intr_num);程序例:#include #include /* function prototype */void writechar(char ch);int

3、main(void) clrscr(); gotoxy(80,25); writechar(*); getch(); return 0;/* outputs a character at the current cursor position using the video BIOS to avoid the scrolling of the screen when writing to location (80,25).*/void writechar(char ch) struct text_info ti; /* grab current text settings */ gettext

4、info(&ti); /* interrupt 0x10 sub-function 9 */ _AH = 9; /* character to be output */ _AL = ch; _BH = 0; /* video page */ _BL = ti.attribute; /* video attribute */ _CX = 1; /* repetition factor */ geninterrupt(0x10); /* output the char */函数名: getarccoords功 能: 取得最后一次调用arc的坐标用 法: void far getarccoords(

5、struct arccoordstype far *arccoords);程序例:#include #include #include #include int main(void)/* request auto detection */ int gdriver = DETECT, gmode, errorcode; struct arccoordstype arcinfo; int midx, midy; int stangle = 45, endangle = 270; char sstr80, estr80;/* initialize graphics and local variabl

6、es */ initgraph(&gdriver, &gmode, );/* read result of initialization */ errorcode = graphresult();/* an error occurred */ if (errorcode != grOk) printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch();/* terminate with an error code */ exit(1); midx = getmaxx()

7、/ 2; midy = getmaxy() / 2;/* draw arc and get coordinates */ setcolor(getmaxcolor(); arc(midx, midy, stangle, endangle, 100); getarccoords(&arcinfo);/* convert arc information into strings */ sprintf(sstr, *- (%d, %d), arcinfo.xstart, arcinfo.ystart); sprintf(estr, *- (%d, %d), arcinfo.xend, arcinfo

8、.yend); /* output the arc information */ outtextxy(arcinfo.xstart, arcinfo.ystart, sstr); outtextxy(arcinfo.xend, arcinfo.yend, estr); /* clean up */ getch(); closegraph(); return 0;函数名: getaspectratio功 能: 返回当前图形模式的纵横比用 法: void far getaspectratio(int far *xasp, int far *yasp);程序例:#include #include #

9、include #include int main(void)/* request auto detection */ int gdriver = DETECT, gmode, errorcode; int xasp, yasp, midx, midy;/* initialize graphics and local variables */ initgraph(&gdriver, &gmode, );/* read result of initialization */ errorcode = graphresult();/* an error occurred */ if (errorco

10、de != grOk) printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch();/* terminate with an error code */ exit(1); midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(getmaxcolor();/* get current aspect ratio settings */ getaspectratio(&xasp, &yasp);/* draw normal

11、 circle */ circle(midx, midy, 100); getch();/* draw wide circle */ cleardevice(); setaspectratio(xasp/2, yasp); circle(midx, midy, 100); getch();/* draw narrow circle */ cleardevice(); setaspectratio(xasp, yasp/2); circle(midx, midy, 100);/* clean up */ getch(); closegraph(); return 0;函数名: getbkcolo

12、r功 能: 返回当前背景颜色用 法: int far getbkcolor(void);程序例:#include #include #include #include #include int main(void) /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int bkcolor, midx, midy; char bkname35;/* initialize graphics and local variables */ initgraph(&gdriver, &gmode, );/* read

13、result of initialization */ errorcode = graphresult();/* an error occurred */ if (errorcode != grOk) printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch();/* terminate with an error code */ exit(1); midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(getmaxco

14、lor();/* for centering text on the display */ settextjustify(CENTER_TEXT, CENTER_TEXT);/* get the current background color */ bkcolor = getbkcolor();/* convert color value into a string */ itoa(bkcolor, bkname, 10); strcat(bkname, is the current background color.);/* display a message */ outtextxy(m

15、idx, midy, bkname);/* clean up */ getch(); closegraph(); return 0;函数名: getc功 能: 从流中取字符用 法: int getc(FILE *stream);程序例:#include int main(void) char ch; printf(Input a character:);/* read a character from the standard input stream */ ch = getc(stdin); printf(The character input was: %cn, ch); return 0

16、;函数名: getcbrk功 能: 获取Control_break设置用 法: int getcbrk(void);程序例:#include #include int main(void) if (getcbrk() printf(Cntrl-brk flag is onn); else printf(Cntrl-brk flag is offn); return 0;函数名: getch功 能: 从控制台无回显地取一个字符用 法: int getch(void);程序例:#include #include int main(void) char ch; printf(Input a char

17、acter:); ch = getche(); printf(nYou input a %cn, ch); return 0;函数名: getchar功 能: 从stdin流中读字符用 法: int getchar(void);程序例:#include int main(void) int c; /* Note that getchar reads from stdin and is line buffered; this means it will not return until you press ENTER. */ while (c = getchar() != n) printf(%

18、c, c); return 0;函数名: getche功 能: 从控制台取字符(带回显)用 法: int getche(void);程序例:#include #include int main(void) char ch; printf(Input a character:); ch = getche(); printf(nYou input a %cn, ch); return 0;函数名: getcolor功 能: 返回当前画线颜色用 法: int far getcolor(void);程序例:#include #include #include #include #include int

19、 main(void)/* request auto detection */ int gdriver = DETECT, gmode, errorcode; int color, midx, midy; char colname35;/* initialize graphics and local variables */ initgraph(&gdriver, &gmode, );/* read result of initialization */ errorcode = graphresult();/* an error occurred */ if (errorcode != grO

20、k) printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch();/* terminate with an error code */ exit(1); midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(getmaxcolor();/* for centering text on the display */ settextjustify(CENTER_TEXT, CENTER_TEXT);/* get the

21、current drawing color */ color = getcolor();/* convert color value into a string */ itoa(color, colname, 10); strcat(colname, is the current drawing color.);/* display a message */ outtextxy(midx, midy, colname);/* clean up */ getch(); closegraph(); return 0;函数名: getcurdir功 能: 取指定驱动器的当前目录用 法: int ge

22、tcurdir(int drive, char *direc);程序例:#include #include #include char *current_directory(char *path) strcpy(path, X:); /* fill string with form of response: X: */ path0 = A + getdisk(); /* replace X with current drive letter */ getcurdir(0, path+3); /* fill rest of string with current directory */ ret

23、urn(path);int main(void) char curdirMAXPATH; current_directory(curdir); printf(The current directory is %sn, curdir); return 0;函数名: getcwd功 能: 取当前工作目录用 法: char *getcwd(char *buf, int n);程序例:#include #include int main(void) char bufferMAXPATH; getcwd(buffer, MAXPATH); printf(The current directory is:

24、 %sn, buffer); return 0;函数名: getdate功 能: 取DOS日期用 法: void getdate(struct *dateblk);程序例:#include #include int main(void) struct date d; getdate(&d); printf(The current year is: %dn, d.da_year); printf(The current day is: %dn, d.da_day); printf(The current month is: %dn, d.da_mon); return 0;函数名: getdef

25、aultpalette功 能: 返回调色板定义结构用 法: struct palettetype *far getdefaultpalette(void);程序例:#include #include #include #include int main(void)/* request auto detection */ int gdriver = DETECT, gmode, errorcode; int i;/* structure for returning palette copy */ struct palettetype far *pal=(void *) 0;/* initiali

26、ze graphics and local variables */ initgraph(&gdriver, &gmode, );/* read result of initialization */ errorcode = graphresult();/* an error occurred */ if (errorcode != grOk) printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch();/* terminate with an error code */ exit(1); setcolor(getmaxcolor();/* return a pointer to the default palette */ pal = getdefaultpalette(); for (i=0; i16; i+

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

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