C語言函數(shù)(c開頭)_第1頁
C語言函數(shù)(c開頭)_第2頁
C語言函數(shù)(c開頭)_第3頁
C語言函數(shù)(c開頭)_第4頁
已閱讀5頁,還剩34頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

函數(shù)大全(c開頭)61函數(shù)名:cabs功能:計(jì)算復(fù)數(shù)的絕對值用法:doublecabs(structcomplexz);程序例:#includc#includeintmain(void)(structcomplexz;doubleval;z.x=2.0;z.y=1.0;val=cabs(z);printf("Theabsolutevalueof%.21fi%.2ifjis%.21f\z.x,z.y,val);return0;)函數(shù)名:calloc功能:分配主存儲器用法:void*calloc(size_tnelem,size_telsize);程序例:#include#includeintmain(void)(char*str=NULL;/*allocatememoryforstring*/str=calloc(10,sizeof(char));/*copy"Hello"intostring*/strcpy(str,"Hello");/*displaystring*/printf("Stringis%s\nM,str);/*freememory*/free(str);return0;函數(shù)名:ceil功能:向上舍入用法:doubleceil(doublex);程序例:#include#includeintmain(void)(doublenumber=123.54;doubledown,up;down=floor(number);up=ceil(number);printff'originalnumber%5.21f\n",number);printf("numberroundeddown%5.21f\n'\down);printf("numbern)undedup%5.21八n",up);return0;函數(shù)名:cgets功能:從控制臺讀字符串用法:char*cgets(char*str);程序例:#include#includeintmain(void){charbuffer[83J;char*p;/*There'sspacefor80charactersplustheNULLterminator*/buffer[0]=81;printf("Inputsomechars:'*);p=cgets(buffer);printf("\ncgetsread%dcharacters:\"%s\"\n",buffer!11,p);printf("Thereturnedpointeris%p,bufferfO]isat%p\n'\p.&buffer);/*Leaveroomfor5charactersplustheNULLterminator*/buffer[O]=6;printf("[nputsomechars:");p=cgets(buffer);printf("\ncgetsread%dcharacters:\"%s\"\n".buffer!1].p);printf("Thereturnedpointeris%p.buffer[O]isat%p\n",p.&buffer);return0;函數(shù)名:chdir功能:改變工作目錄用法:intchdir(constchar*path);程序例:#include#include#includecharold_dir[MAXDIR];charncw_dir!MAXDIR];intmain(void){if(getcurdir(O,old.dir))perror(Hgetcuniir()M);exit(l);)printf("Currentdirectoryis:\\%s\n",old_dir);if(chdir(H\V)){perror("chdir()");exit(l);)if(getcurdir(O,new_dir)){perror("getcurdir()");exit(l);(printf("Currentdirectoryisnow:\\%s\n",new_dir);printf("\nChangingbacktoorignaldirectory:\\%s\n'\old_dir);if(chdir(old_dir))(perror("chdir()");exit(l);Ireturn0;函數(shù)名:—chmod,chmod功能:改變文件的訪問方式用法:intchmod(constchar*filename,intpermiss);程序例:#include#include#includevoidmake_read_only(char*filename);make_read_only("NOTEXIST.FIL");make_read_only("MYFILE.FIL");return0;}voidmake_read_only(char*filename)(intstat;stat=chmod(filename,S_IREAD);if(stat)printfC'Couldn'tmake%sread-only\nf',filename);elseprintf("Made%sread-onlyXn1',filename);函數(shù)名:chsize功能:改變文件大小用法:intchsize(inthandle,longsize);程序例:#include#include#includeintmain(void)(inthandle;charbufll1]=M0123456789";/*createtextfilecontaining10bytes*/handle=open("DUMMY.FIL",O.CREAT);write(handle.buf,strlen(buf));/*truncatethefileto5bytesinsize*/chsize(handle,5);/*closethefile*/close(handle);return0;函數(shù)名:circle功能:在給定半徑以(x,y)為圓心畫圓用法:voidfarcircle(y,intradius);程序例:#includc#include#include#includeintmain(void)(/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intmidx,midy;intradius=100;/*initializegraphicsandlocalvariables*/initgraph(&gdriver,&gmodc,,,M);/*readresultofinitialization*/errorcode=graphresult();if(errorcode!=grOk)/*anerroroccurred*/(printf("Graphicserror:%s\n",grapherrormsg(errorcode));printf("Pressanykeytohalt:");getch();exit(l);/*terminatewithanerrorcode*/)midx=gctmaxx()/2;midy=getmaxyO/2;setcolor(getmaxcolor());/*drawthecircle*/circle(midx,midy,radius);/*cleanup*/getch();closegraph();return0;函數(shù)名:cleardevice功能:清除圖形屏幕用ii:voidfarcleardevice(void);程序例:#include#include#include#includeintmain(void)(/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intmidx,midy;/*initializegraphicsandlocalvariables*/initgraph(&gdriver,&gmode./*readresultofinitialization*/errorcode=graphresult();if(errorcode!=grOk)/*anerroroccurred*/{printf("Graphicserror:%s\n”,grapherrormsg(errorcode));printf("Pressanykeytohalt:*');getch();exit(I);/*terminatewithanerrorcode*/)midx=getmaxx()/2;midy=getmaxyO/2;setcolor(getmaxcolor());/*forcenteringscreenmessages*/settextjustify(CENTER_TEXTCENTER.TEXT);/*outputamessagetothescreen*/outtextxy(midx,midy,"pressanykeytoclearthescreen:");/*waitforakey*/getch();/*clearthescreen*/cleardeviceO;/*outputanothermessage*/outtextxy(midx,midy,"pressanykeytoquit:");/*cleanup*/getch();closegraph();return0;函數(shù)名:cleareu功能:復(fù)位錯(cuò)誤標(biāo)志用法:voidclearerr(FILE*stream);程序例:#includeintmain(void)(FILE*fp;charch;/*openafileforwriting*/fp=fbpen("DUMMY.FIL","w");/*forceanerrorconditionbyattemptingtoread*/ch=fgetc(fp);printf(M%c\n'\ch);if(ferror(fp)){/*displayanerrormessage*/printfC'ErrorreadingfromDUMMY.FIL\n");/*resettheerrorandEOFindicators*/clearerr(fp);fclose(fp):return0;)函數(shù)名:clearviewport功能:清除圖形視區(qū)用法:voidfarclearviewport(void);程序例:#include#include#include#include#defineCLIP_ON1/*activatesclippinginviewport*/intmain(void)(/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intht;/*initializegraphicsandlocalvariables*/initgraph(&gdriver,&gmode,/*readresultofinitialization*/errorcode=graphresult();if(errorcode!=grOk)/*anerroroccurred*/{printf("Graphicserror:%s\n”,grapherrormsg(errorcode));printf("Pressanykeytohalt:'1);getch();exit(1);/*terminatewithanerrorcode*/)setcolor(getmaxcolor());ht=textheight(HWM);/*messageindefaultfull-screenviewport*/outtextxy(0,0,“*<—(0,0)indefaultviewport");/*createasmallerviewport*/setviewport(50.50,getmaxx()-50,getmaxy()-50,CLIP_ON);/*displaysomemessages*/outtextxy(0,〇,”*<—(0,0)insmallerviewport");outtextxy(0,2*ht,"Pressanykeytoclearviewport:");/*waitforakey?/getch();/*cleartheviewport*/clearviewport();/*outputanothermessage*/outtextxy(0,0,"Pressanykeytoquit:");/*cleanup*/getch();closcgraph();return0;)函數(shù)名:一close,close功能:關(guān)閉文件句柄用法:intclose(inthandle);程序例:#include#include#include#includemain(){inthandle;charbuflll]="0123456789";/*createafilecontaining10bytes*/handle=open("NEW.FIL",O_CREAT);if(handle>-1)write(handlc.buf,strlen(buD);/*closethefile*/close(handle);)else(printf("Erroropeningfile\nH);(return0;函數(shù)名:clock功能:確定處理器時(shí)間用法:clock_tclock(void);程序例:#include#include#includeintmain(void){clock_tstart,end;start=clock();delay(20()0);end=clock();printf("Thetimewas:%f\nH,(end-start)/CLK_TCK);return0;函數(shù)名:closegraph功能:關(guān)閉圖形系統(tǒng)用法:voidfarclosegraph(void);程序例:#include#include#include#includeintmain(void)(/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intx,y;/*initializegraphicsmode*/initgraph(&gdriver,&gmodc,"M);/*readresultofinitialization*/errorcode=graphresult();if(errorcode!=grOk)/*anerroroccurred*/(printf("Graphicserror:%s\n",grapherrormsg(errorcode));printf("Pressanykeytohalt:");gelch();exit(l);/*terminatewithanerrorcode*/)x=getmaxx()/2;y=getmaxyO/2;/*outputamessage*/settextjustify(CENTER_TEXl;CENTER_TEXT);outtextxy(x,y,"Pressakeytoclosethegraphicssystem:");/*waitforakey?/gelch();/*closesdownthegraphicssystem*/closegraph();printf("We'renowbackintextmode.\n");printf("Pressanykeytohalt:");getch();return0;函數(shù)名:ckeol功能:在文本窗口中清除字符到行末用法:voidclreol(void);程序例:#includeintmain(void)(clrscr();cprintf("ThefunctionCLREOLclearsallcharactersfromthe\r\nH);cprintf(ncursorpositiontotheendofthelinewithinthe\r\nM);cprintfC'currenttextwindow,withoutmovingthecursor.\r\n");cprintf("Pressanykeytocontinue…り;gotoxy(14.4);getch();clreol();getch();return0;函數(shù)名:clrscr功能:清除文本模式窗口用法:voidclrscr(void);程序例:#includcintmain(void)inti;clrscr();for(i=0;i<20;i++)cprintf("%d\r\n".i);cprintf("\r\nPressanykeytoclearscreen");getch();clrscr();cprintf("Thescreenhasbeencleared!");getch();return0;函數(shù)名:coreleft功能:返冋未使用內(nèi)存的大小用法:unsignedcoreleft(void);程序例:#include#includeintmain(void)(printff'Thedifferencebetweenthehighestallocatedblockand\n");printf("thetopoftheheapis:%lubytes\n",(unsignedlong)coreleft());return0;函數(shù)名:cos功能:余弦函數(shù)用法:doublecos(doublex);程序例:#include#includedoubleresult;doublex=0.5;result=cos(x);printf("Thecosineof%Ifis%lf\nM,x,result);return0;函數(shù)名:cosh功能:雙曲余弦函數(shù)用法:dlublecosh(doublex);程序例:#include#includeintmain(void)(doubleresult;doublex=0.5;result=cosh(x);printfC'Thehyperboiccosineof%lfis%lf\n",x,result);return0;函數(shù)名:country功能:返回與國家有關(guān)的信息用法:structCOUNTRY*country(intcountrycode,structcountry*country);程序例:#include#includc#defineUSA0structCOUNTRYcountry_info;countiy(USA,&country_info);printf("ThecurrencysymbolfortheUSAis:%s\n",country_info.co_curr);return0;函數(shù)名:cprinU、功能:送格式化輸出至屏幕用法:intcprintf(constchar*format[,argument,...]);程序例:#includeintmain(void)(/*clearthescreen*/clrscr();/*createatextwindow*/window(10,10,80,25);/*outputsometextinthewindow*/cprintfC'Helloworld\r'n");/*waitforakey*/getch();return0;函數(shù)名:cputs功能:寫字符到屏幕用法:voidcputs(constchar*string);程序例:#include/*clearthescreen*/clrscr();/*createatextwindow*/window(10,10,80,25);/*outputsometextinthewindow*/cputs(nThisiswithinthewindow\r\nM);/*waitforakey*/getch();return0;函數(shù)名:—creatcreat功能:創(chuàng)建一個(gè)新文件或重寫ー個(gè)已存在的文件用法:intcreat(constchar*filename,intpermiss);程序例:#include#include#include#includeintmain(void)(inthandle;charbuf[ll]="0123456789";/*changethedefaultfilemodefromtexttobinary*/_fmode=O_BINARY;/*createabinaryfileforreadingandwriting*/handle=creat("DUMMY.HL,\S_IREADIS.IWRITE);/*write10bytestothefile*/write(handle.buf,strlen(buf));/*closethefile*/close(handle);return0;函數(shù)名:creatnew功能:創(chuàng)建一個(gè)新文件用法:intcreatnew(constchar*filename,intattrib);程序例:#include#include#include#include#includcintmain(void)(inthandle;charbufll1]=M0123456789";/*attempttocreateafilethatdoesn'talreadyexist*/handle=creatnew("DUMMY.FIL",0);if(handle==-1)printfC'DUMMY.FILalreadyexistsAn");else{printfC'DUMMY.FILsuccessfullycreated.\n");write(handle.buf,strlen(buf));close(handle);)return0;函數(shù)名:creattemp功能:創(chuàng)建一個(gè)新文件或重寫ー個(gè)已存在的文件用法:intcreattemp(constchar*filename,intattrib);程序例:#include#includeintmain(void){inthandle;charpathname(128];strcpy(pathname,"\\");/*createauniquefileintherootdirectory?/handle=creattemp(pathname,0);printf("%swastheuniquefilecreated.\n",pathname);closc(handlc);return0;函數(shù)名:cscanf功能:從控制臺執(zhí)行格式化輸入用法:intcscanf(char*format),argument,...]);程序例:#includeintmain(void)(charstring[80J;/*clearthescreen*/clrscr();/*Prompttheuserfbrinput*/cprintf("Enterastringwithnospaces:M);/*readtheinput*/cscanf(,,%s,\string);/*displaywhatwasread*/cprintf(n\r\nThestringenteredis:%s”,string);return0;函數(shù)名:clime功能:把日期和時(shí)間轉(zhuǎn)換為字符中用法:char*ctime(const*time);程序例:#include#includeintmain(void)(t;time(&t);printfC'lbday'sdateandtime:%s\n",ctime(&t));return0;函數(shù)名:ctrlbrk功能:設(shè)置Ctrl-Break處理程序用法:voidctrlbrk(*fptr)(void);程序例:#include#include#defineABORT0intc_break(void)(printft"Control-Breakpressed.Programaborting..An");return(ABORT);1intmain(void){ctrlbrk(c_break);foK;;)printf("Looping...Presstoquit:\nH);)return0;函數(shù)大全(c開頭)函數(shù)名:cabs功能:計(jì)算復(fù)數(shù)的絕對值用法:doublecabs(structcomplexz);程序例:#include#includeintmain(void)(structcomplexz;doubleval;z.x=2.0;z.y=1.0;val=cabs(z);printf("Theabsolutevalueof%.21fi%.21fjis%.21f\z.x,z.y,val);return0;函數(shù)名:calloc功能:分配主存儲器用法:void*calloc(size_tnelem,size_telsize);程序例:#include#includechar*str=NULL;/*allocatememoryforstring*/str=calloc(10,sizeof(char));/*copy"Hello"intostring*/strcpy(stn"Hello");/*displaystring*/printf("Stringis%s\n",str);/*freememory*/free(str);return0;函數(shù)名:ceil功能:向上舍入用法:doubleceil(doublex);程序例:#include#includeintmain(void)(doublenumber=123.54;doubledown,up;down=floor(number);up=ceil(number);printff'originalnumber%5.21t\n",number);printf("numbcrroundeddown%5.21f\n'\down);printf("numbcrroundedup%5.21f\n",up);return0;函數(shù)名:cgets功能:從控制臺讀字符串用法:char*cgets(char*str);程序例:#includc#includeintmain(void)(charbuffer!83J;char*p;/*There'sspacefor80charactersplustheNULLterminator*/buffer[0]=81;printf("[nputsomechars:*');p=cgets(buffer);printf("\ncgetsread%dcharacters:\"%sV'\n".buffer[1レp);printf("Thereturnedpointeris%p.buffer[0]isat%p\n",p.&buffer);/*Leaveroomfor5charactersplustheNULLterminator*/buffer!0]=6;printf("Inputsomechars:");p=cgets(buffer);printf("\ncgetsread%dcharacters:\"%s\H\n",buffer]1],p);printf("Thereturnedpointeris%p,buffer[O]isat%p\n",p,&buffer);return0;函數(shù)名:chdir功能:改變工作目錄用法:intchdir(constchar*path);程序例:#include#include#includecharold_dir[MAXDIR];charnew_dir[MAXDIR];intmain(void)(if(getcurdir(O,old_dir))(pcirorCgetcurdirO'');exit(l);)printf("Currentdirectoryis:\\%s\n",old_dir);if(chdir("\\")){perrorC'chdirO',);exit(1);)if(getcurdir(O,new_dir))(perrorCgetcurdirO1');exit(l);Iprintf("Currentdirectoryisnow:\\%s\nM,new_dir);printf("\nChangingbacktoorignaldirectory:\\%s\n'\old_dir);if(chdir(old_dir))(perror(セhdir〇”);exit(l);)return0;函數(shù)名:一chmod.chmod功能:改變文件的訪問方式用法:intchm(xi(constchar*filename,intpermiss);程序例:#include#includcvoidmake_read_only(char*filename);intmain(void)make_read_only("NOTEXIST.FIL");make_read_onIy(''MYFILE.FILn);return0;)voidmake_read_only(char*filename)(intstat;stat=chmod(filename,S_IREAD);if(stat)printf("Couldn'tmake%sread-onlyXn1',filename);elseprintf("Made%sread-only\n",filename);)函數(shù)名:chsize功能:改變文件大小用法:intchsize(inthandle,longsize);程序例:#include#include#includeintmain(void)(inthandle;charbuf[lll="0123456789";/*createtextfilecontaining10bytes*/handle=open("DUMMY.FIL",O.CREAT);write(handle,buf,strlen(buf));/*truncatethefileto5bytesinsize*/chsize(handle,5);/*closethefile*/close(handle);return0;函數(shù)名:circle功能:在給定半徑以(x,y)為圓心畫圓用法:voidfarcircle(intx,inty,intradius);程序例:#include#include#include#includeintmain(void)(/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intmidx,midy;intradius=100;/*initializegraphicsandlocalvariables*/initgraph(&gdriver,&gmode,/*readresultofinitialization*/errorcode=graphresult();if(errorcodc!=grOk)/*anerroroccurred*/{printf("Graphicserror:%s\n”,grapherrormsg(errorcode));printf("Pressanykeytohalt:");gelch();exit(l);/*terminatewithanerrorcode*/1midx=getmaxx()/2;midy=getmaxyO/2;setcolor(getmaxcolor());/*drawthecircle*/circle(midx,midy,radius);/*cleanup*/getch();closegraph();return0;函數(shù)名:cleardevice功能:清除圖形屛幕用?£:voidfarcleardevice(void);程序例:#include#include#include#includeintmain(void)(/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intmidx,midy;/*initializegraphicsandlocalvariables*/initgraph(&gdriver,&gmode,"");/*readresultofinitialization*/errorcode=graphresultO;if(errorcode!=grOk)/*anerroroccurred*/{printf("Graphicserror:%s\nH,grapherrormsg(errorcode));printf("Pressanykeytohalt:");getch();exit(l);/*terminatewithanerrorcode*/midx=getmaxx()/2;midy=getmaxyO/2;setcolor(getmaxcolor());/*fbrcenteringscreenmessages*/settextjustify(CENTER_TEXTCENTER_TEXT);/*outputamessagetothescreen*/outtextxy(midx,midy,"pressanykeytoclearthescreen:H);/*waitforakey*/getch();/*clearthescreen*/cleardevice();/*outputanothermessage*/outtextxy(midx,midy,"pressanykeytoquit:");/*cleanup*/getch();closegraph();return0;函數(shù)名:clearerr功能:復(fù)位錯(cuò)誤標(biāo)志用法:voidclearerr(F!LE*stream);程序例:#includeintmain(void){FILE*fp;charch;/*openafilefbrwriting*/fp=fopen("DUMMY.FIL","w");/*forceanerrorconditionbyattemptingtoread*/ch=fgetc(fp);printf("%c\n",ch);if(ferror(fp))/*displayanerrormessage*/printfC'ErrorreadingfromDUMMY.FIL\n");/*resettheerrorandEOFindicators*/clearerr(fp);1fclose(fp):return0;函數(shù)名:clearviewport功能:清除圖形視區(qū)用法:voidfarclearviewport(void);程序例:#include#include#include#include#defineCLIP_ON1/*activatesclippinginviewport*/intmain(void)(/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intht;/*initializegraphicsandlocalvariables*/initgraph(&gdriver,&gmode,/*readresultofinitialization*/errorcode=graphresult();if(errorcode!=grOk)/*anerroroccurred*/printff'Graphicserror:%s\nM,grapherrormsg(errorcode));printf("Pressanykeytohalt:");getch();exit(1);/*terminatewithanerrorcode*/setcolor(getmaxcolor());ht=textheight("W");/*messageindefaultfull-screenviewport*/outtextxy(0,〇,”*<—(0,0)indefaultviewport");/*createasmallerviewport*/setviewport(50,50,getmaxx()-50,getmaxy()-50,CL1P_ON);/*displaysomemessages*/outtextxy(0,0,"*<—(0,0)insmallerviewport");outtextxy(0,2*ht,"Pressanykeytoclearviewport:");/*waitforakey?/getch();/*cleartheviewport*/clearviewport();/*outputanothermessage*/outtextxy(0,0,"Pressanykeytoquit");/*cleanup*/getch();closegraph();return0;函數(shù)名:」:lose,close功能:關(guān)閉文件句柄用法:intclose(inthandle);程序例:#include#include#include#includemain()inthandle;charbufIll]=nO123456789";/*createafilecontaining10bytes*/handle=open("NEW.FIL",O_CREAT);if(handle>-1)(write(handle,buf,strlen(buf));/*closethefile*/close(handle);)else(printf("Erroropeningfile\nM);)return0;函數(shù)名:clock功能:確定處理器時(shí)間用法:clock_tclock(void);程序例:#include#include#includeintmain(void){clock_tstart,end;start=clock();delay(2000);end=clock();printf("Thetimewas:%f\nM,(end-start)/CLK.TCK);return0;函數(shù)名:closegraph功能:關(guān)閉圖形系統(tǒng)用法:voidfarclosegraph(void);程序例:#include#include#include#includcintmain(void)(/*requestautodetection*/intgdriver=DETECT,gmode,errorcode;intx,y;/*initializegraphicsmode*/initgraph(&gdriver,&gmode,/*readresultofinitialization*/errorcode=graphresult();if(errorcode!=grOk)/*anerroroccurred*/(printf("Graphicserror:%s\n",grapheirormsg(eiTorcode));printf("Pressanykeytohalt:*');gctch();exit(l);/*terminatewithanerrorcode*/)x=getmaxx()/2;y=getmaxyO/2;/*outputamessage*/settextjustify(CENTER_TEXTCENTER.TEXT);outtextxy(x,y,"Pressakeytoclosethegraphicssystem:");/*waitforakey*/getch();/*closesdownthegraphicssystem*/closegraph();printfC'WeVenowbackintextmode.\n");printf("Pressanykeytohalt:");getch();return0;函數(shù)名:clreol功能:在文本窗口中清除字符到行末用法:voidclreol(void);程序例:#includeintmain(void)(clrscr();cprintf("ThefunctionCLREOLclearsallcharactersfromthe\r\n");cprintf("cursorpositiontotheendofthelinewithinthe\An");cprintf("currenttextwindow,withoutmovingthecursor.\r\n");cprintf("Pressanykeytocontinue..gotoxy(14,4);getch();clreol();getch();return0;函數(shù)名:clrscr功能:清除文本模式窗口用法:voidclrscr(void);程序例:#includeintmain(void)(inti;clrscr();for(i=0;i<20;i++)cprintf(M%d\r\n';i);cprintf(n\r\nPressanykeytoclearscreen");getch();clrscr();cprintf("Thescreenhasbeencleared!");getch();return0;函數(shù)名:coreleft功能:返回未使用內(nèi)存的大小用法:unsignedcoreleft(void);程序例:#include#includeintmain(void){printf("Thedifferencebetweenthehighestallocatedblockand\nn);printf("thetopoftheheapis:%lubytes\n",(unsignedlong)coreleftO);return0;函數(shù)名:cos功能:余弦函數(shù)用法:doublecos(doublex);程序例:#include#includeintmain(void)doubleresult;doublex=0.5;result=cos(x);printfC'Thecosineof%Ifis%lf\n*\x,result);return0;函數(shù)名:cosh功能:雙曲余弦函數(shù)用法:dlublecosh(doublex);程序例:#include#includeintmain(void){doubleresult;doublex=0.5;result=cosh(x);printfC'Thehyperboiccosineof%lfis%lf\n",x,result);return0;函數(shù)名:country功能:返冋與國家有關(guān)的信息用法:structCOUNTRY*country(intcountrycode,structcountry*country);程序例:#include#includc#defineUSA0intmain(void)structCOUNTRYcountry_info;countiy(USA,&country_info);printfC^ThecurrencysymbolfortheUSAis:%s\n",countiy_info.co_curr);return0;函數(shù)名:cprintf功能:送格式化輸出至屏幕用法:intcprintf(constchar*format[,argument,...]);程序例:#includeintmain(void){/*clearthescreen*/clrscr();/*createatextwindow*/window(10,10,80,25);/*outputsometextinthewindow*/cprintf("Helloworld\AnH);/*waitforakey*/getch();return0;函數(shù)名:cputs功能:寫字符到屏幕用法:void

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論