【正文】
。::main(){int a,i,aa[4],t。a)。aa[1]=a%100/10。aa[3]=a/1000。i=3?!a[i]%=10。i=3/2。 aa[i]=aa[3i]。 }for(i=3。i)printf(%d,aa[i])。::include define M 5main(){int a[M]={1,2,3,4,5}。i=0。while(i {t=*(a+i)。*(a+j)=t。j。i printf(%d,*(a+i))。 /*define a longint time varible*/lt=time(NULL)。 /*english format output*/printf(asctime(localtime()))。 /*tranfer to Greenwich time*/}==============================================================【程序92】題目:時間函數(shù)舉例2: ?。?*calculate time*/include include main(){ time_t start,end。start=time(NULL)。i3000。}end=time(NULL)。}==============================================================【程序93】題目:時間函數(shù)舉例3::/*calculate time*/include include main(){ clock_t start,end。double var。for(i=0。i++){ printf(\1\1\1\1\1\1\1\1\1\1\n)。printf(\1: The different is %\n,(double)(endstart))。(版主初學(xué)時編的)::include include include main(){char c。time_t a,b。int i,guess。printf(do you want to play it.(39。 or 39。) \n)。y39。printf(\nplease input number you guess:\n)。a=time(NULL)。guess)。scanf(%d,amp。}else{printf(please input a little bigger.\n)。guess)。b=time(NULL)。printf(\1: it took you % seconds\n\n,difftime(b,a))。else if(var25)printf(\1\1 you are normal! \1\1\n\n)。printf(\1\1 Congradulations \1\1\n\n)。}printf(\ndo you want to try it again?(\yy\.or.\n\)\n)。y39。}==============================================================【程序95】題目:家庭財務(wù)管理小程序::/*money management system*/include include main(){FILE *fp。float sum,chm=。int c。pp: clrscr()。gotoxy(1,1)。gotoxy(1,2)。gotoxy(1,3)。gotoxy(1,4)。gotoxy(1,5)。gotoxy(1,6)。gotoxy(1,7)。gotoxy(1,8)。gotoxy(1,9)。gotoxy(1,10)。gotoxy(1,11)。gotoxy(1,12)。gotoxy(1,13)。gotoxy(1,14)。gotoxy(1,15)。gotoxy(1,16)。gotoxy(1,17)。gotoxy(1,18)。gotoxy(1,19)。gotoxy(1,20)。gotoxy(1,21)。gotoxy(1,22)。gotoxy(1,23)。i=0。d)。for(。printf( Tab __browse cost list Esc __quit)。printf( )。printf( )。printf(%s,chtime)。ch[0]=getch()。strcpy(chshop,)。if(ch[0]==9){mm:i=0。gotoxy(3,24)。gotoxy(6,4)。gotoxy(1,5)。gotoxy(41,4)。gotoxy(41,5)。while(fscanf(fp,%10s%14s%f\n,chtime,chshop,amp。i=0。printf( )。}elseif((i%36)16){ gotoxy(41,4+i17)。gotoxy(42,4+i17)。sum=sum+chm。}gotoxy(1,23)。gotoxy(1,24)。gotoxy(1,25)。gotoxy(10,24)。fclose(fp)。printf(press any key to.....)。goto pp。\r39。j++。if(j15){ len=len+1。}strcpy(ch1,)。strncat(ch1,chtime,len)。strncat(chtime,ch1,len1)。printf( )。printf(%s,chtime)。if(ch[0]==9)goto mm。}gotoxy(3,24)。gotoxy(13,10)。ch[0]=getch()。\r39。j++。strcpy(ch1,)。strncat(ch1,chshop,len)。strncat(chshop,ch1,len1)。printf( )。printf(%s,chshop)。}gotoxy(13,13)。ch[0]=getch()。\r39。j++。strcpy(ch1,)。strncat(ch1,chmoney,len)。strncat(chmoney,ch1,len1)。printf( )。printf(%s,chmoney)。}if((strlen(chshop)==0)||(strlen(chmoney)==0))continue。fprintf(fp,%10s%14s%6s,chtime,chshop,chmoney)。\n39。fclose(fp)。gotoxy(41,5+i)。}}} ==============================================================【程序96】題目:計算字符串中子串出現(xiàn)的次數(shù)::include include main(){ char str1[20],str2[20],*p1,*p2。printf(please input two strings\n)。p1=str1。while(*p1!=39。){if(*p1==*p2){while(*p1==*p2amp。*p2!=39。){p1++。}}elsep1++。\039。p2=str2。getch()。: ?。篿nclude main(){ FILE *fp。scanf(%s,filename)。exit(0)。ch=getchar()。39。putchar(ch)。}fclose(fp)?! ≥斎氲淖址裕〗Y(jié)束。char str[100],filename[10]。if((fp=fopen(test,w))==NULL){ printf(cannot open the file\n)。}printf(please input a string:\n)。while(str[i]!=39。){ if(str[i]=39。amp。str[i]=39。)str[i]=str[i]32。i++。fp=fopen(test,r)。printf(%s\n,str)。}==============================================================【程序99】題目:有兩個磁盤文件A和B,各存放一行字母,要求把這兩個文件中的信息合并(按字母順序排列), 輸出到一個新文件C中。int i,j,n,ni。if((fp=fopen(A,r))==NULL){printf(file A cannot be opened\n)。}printf(\n A contents are :\n)。(ch=fgetc(fp))!=EOF。putchar(c[i])。ni=i。exit(0)。for(i=0。i++){c[i]=ch。}fclose(fp)。for(i=0。I++)for(j=i+1。J++)if(c[i]c[j]){t=c[i]。c[j]=t。fp=fopen(C,w)。iN。putchar(c[i])。}==============================================================【程序100】題目:有五個學(xué)生,每個學(xué)生有3門課的成績,從鍵盤輸入以上數(shù)據(jù)(包括學(xué)生號,姓名,三門課成績),計算出 平均成績,況原有的數(shù)據(jù)和計算出的平均分?jǐn)?shù)存放在磁盤文件stud中。char name[8]。float avr。main(){int i,j,sum。/*input*/for(i=0。i++){ printf(\n please input No. %d score:\n,i)。scanf(%s,stu[i].num)。scanf(%s,stu[i].name)。for(j=0。j++){ printf(score %d.,j+1)。stu[i].score[j])。}stu[i].avr=sum/。for(i=0。i++)if(fwrite(amp。fclose(f