C语言函数大全s开头1Word格式文档下载.docx

上传人:b****4 文档编号:6573767 上传时间:2023-05-07 格式:DOCX 页数:40 大小:23.85KB
下载 相关 举报
C语言函数大全s开头1Word格式文档下载.docx_第1页
第1页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第2页
第2页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第3页
第3页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第4页
第4页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第5页
第5页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第6页
第6页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第7页
第7页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第8页
第8页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第9页
第9页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第10页
第10页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第11页
第11页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第12页
第12页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第13页
第13页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第14页
第14页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第15页
第15页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第16页
第16页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第17页
第17页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第18页
第18页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第19页
第19页 / 共40页
C语言函数大全s开头1Word格式文档下载.docx_第20页
第20页 / 共40页
亲,该文档总共40页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

C语言函数大全s开头1Word格式文档下载.docx

《C语言函数大全s开头1Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《C语言函数大全s开头1Word格式文档下载.docx(40页珍藏版)》请在冰点文库上搜索。

C语言函数大全s开头1Word格式文档下载.docx

intscanf(char*format[,argument,...]);

charlabel[20];

charname[20];

intentries=0;

intloop,age;

doublesalary;

structEntry_struct

intage;

floatsalary;

}entry[20];

/*Inputalabelasastringofcharactersrestrictingto20characters*/

\n\nPleaseenteralabelforthechart:

"

scanf("

%20s"

label);

fflush(stdin);

/*flushtheinputstreamincaseofbadinput*/

/*Inputnumberofentriesasaninteger*/

Howmanyentrieswilltherebe?

(lessthan20)"

%d"

&

entries);

/*inputanamerestrictinginputtoonlylettersupperorlowercase*/

for(loop=0;

loop

Entry%d\n"

loop);

Name:

%[A-Za-z]"

entry[loop].name);

/*inputanageasaninteger*/

Age:

entry[loop].age);

/*inputasalaryasafloat*/

Salary:

%f"

entry[loop].salary);

/*Inputaname,ageandsalaryasastring,integer,anddouble*/

\nPleaseenteryourname,ageandsalary\n"

%20s%d%lf"

name,&

age,&

salary);

/*Printoutthedatathatwasinput*/

\n\nTable%s\n"

label);

Compiledby%sage%d$%15.2lf\n"

name,age,salary);

-----------------------------------------------------\n"

%4d|%-20s|%5d|%15.2lf\n"

loop+1,

entry[loop].name,

entry[loop].age,

searchpath

搜索DOS路径

char*searchpath(char*filename);

char*p;

/*LooksforTLINKandreturnsapointer

tothepath*/

p=searchpath("

TLINK.EXE"

SearchforTLINK.EXE:

%s\n"

p);

/*Looksfornon-existentfile*/

NOTEXIST.FIL"

SearchforNOTEXIST.FIL:

sector

画并填充椭圆扇区

voidfarsector(intx,inty,intstangle,intendangle);

/*requestautodetection*/

intgdriver=DETECT,gmode,errorcode;

intmidx,midy,i;

intstangle=45,endangle=135;

intxrad=100,yrad=50;

/*initializegraphicsandlocalvariables*/

initgraph(&

gdriver,&

gmode,"

"

/*readresultofinitialization*/

errorcode=graphresult();

if(errorcode!

=grOk)/*anerroroccurred*/

Graphicserror:

grapherrormsg(errorcode));

Pressanykeytohalt:

getch();

exit

(1);

/*terminatewithanerrorcode*/

midx=getmaxx()/2;

midy=getmaxy()/2;

/*loopthroughthefillpatterns*/

for(i=EMPTY_FILL;

i

/*setthefillstyle*/

setfillstyle(i,getmaxcolor());

/*drawthesectorslice*/

sector(midx,midy,stangle,endangle,xrad,yrad);

/*cleanup*/

closegraph();

segread

读段寄存器值

voidsegread(structSREGS*segtbl);

structSREGSsegs;

segread(&

segs);

Currentsegmentregistersettings\n\n"

CS:

%XDS:

%X\n"

segs.cs,segs.ds);

ES:

%XSS:

segs.es,segs.ss);

setactivepage

设置图形输出活动页

voidfarsetactivepage(intpagenum);

/*selectadriverandmodethatsupports*/

/*multiplepages.*/

intgdriver=EGA,gmode=EGAHI,errorcode;

intx,y,ht;

x=getmaxx()/2;

y=getmaxy()/2;

ht=textheight("

W"

/*selecttheoffscreenpagefordrawing*/

setactivepage

(1);

/*drawalineonpage#1*/

line(0,0,getmaxx(),getmaxy());

/*outputamessageonpage#1*/

settextjustify(CENTER_TEXT,CENTER_TEXT);

outtextxy(x,y,"

Thisispage#1:

outtextxy(x,y+ht,"

/*selectdrawingtopage#0*/

setactivepage(0);

/*outputamessageonpage#0*/

Thisispage#0."

Pressanykeytoviewpage#1:

/*selectpage#1asthevisiblepage*/

setvisualpage

(1);

setallpallette

按指定方式改变所有的调色板颜色

voidfarsetallpallette(structpalette,far*pallette);

structpalettetypepal;

intcolor,maxcolor,ht;

inty=10;

charmsg[80];

maxcolor=getmaxcolor();

ht=2*textheight("

/*grabacopyofthepalette*/

getpalette(&

pal);

/*displaythedefaultpalettecolors*/

for(color=1;

color<

=maxcolor;

color++)

setcolor(color);

sprintf(msg,"

Color:

%d"

color);

outtextxy(1,y,msg);

y+=ht;

/*waitforakey*/

/*blackoutthecolorsonebyone*/

setpalette(color,BLACK);

/*restorethepalettecolors*/

setallpalette(&

setaspectratio

设置图形纵横比

voidfarsetaspectratio(intxasp,intyasp);

intxasp,yasp,midx,midy;

setcolor(getmaxcolor());

/*getcurrentaspectratiosettings*/

getaspectratio(&

xasp,&

yasp);

/*drawnormalcircle*/

circle(midx,midy,100);

/*claerthescreen*/

cleardevice();

/*adjusttheaspectforawidecircle*/

setaspectratio(xasp/2,yasp);

/*adjusttheaspectforanarrowcircle*/

setaspectratio(xasp,yasp/2);

setbkcolor

用调色板设置当前背景颜色

voidfarsetbkcolor(intcolor);

/*multiplebackgroundcolors.*/

intbkcol,maxcolor,x,y;

/*maximumcolorindexsupported*/

/*forcenteringtextmessages*/

/*loopthroughtheavailablecolors*/

for(bkcol=0;

bkcol<

bkcol++)

/*clearthescreen*/

/*selectanewbackgroundcolor*/

setbkcolor(bkcol);

/*outputamesssage*/

if(bkcol==WHITE)

setcolor(EGA_BLUE);

Backgroundcolor:

bkcol);

outtextxy(x,y,msg);

setblock

修改先前已分配的DOS存储段大小

intsetblock(intseg,intnewsize);

unsignedintsize,segp;

intstat;

size=64;

/*(64x16)=1024bytes*/

stat=allocmem(size,&

segp);

if(stat==-1)

Allocatedmemoryatsegment:

segp);

else

Failed:

maximumnumberofparagraphsavailableis%d\n"

stat);

stat=setblock(segp,size*2);

Expandedmemoryblockatsegment:

freemem(segp);

setbuf

把缓冲区与流相联

voidsetbuf(FILE*steam,char*buf);

/*BUFSIZisdefinedinstdio.h*/

charoutbuf[BUFSIZ];

/*attachabuffertothestandardoutputstream*/

setbuf(stdout,outbuf);

/*putsomecharactersin

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 表格模板 > 表格类模板

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2