freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

大一c語言上機(jī)實(shí)驗(yàn)試題和答案-資料下載頁

2025-06-07 17:27本頁面
  

【正文】 等數(shù)學(xué)、物理、計算機(jī))中的至少一個字段進(jìn)行排序,并顯示其結(jié)果。4) 使用函數(shù)方法定義各個模塊。將磁盤上一個文本文件的內(nèi)容復(fù)制到另一個文件中。(實(shí)驗(yàn)指導(dǎo)書P199)從鍵盤輸入一行字符串,將其中的小寫字母全部轉(zhuǎn)換成大寫字母,輸出到一個磁盤文件“”中保存,然后讀出并輸出在屏幕上。(實(shí)驗(yàn)指導(dǎo)書P204)四、實(shí)驗(yàn)步驟與過程:五、實(shí)驗(yàn)調(diào)試記錄:六、參考答案:include include struct person { char name[20]。 int count。}a[6]={“zhang”,0,“l(fā)i”,0,“wang”,0,“zhao”,0,“l(fā)iu”,0,“zhu”,0}。void main( ) { int i,j。 char abc[20]。 for(i=1。i=10。i++) { printf(“輸入候選人名字:”)。 scanf(“%s”,abc)。 for(j=0。j6。j++) if(strcmp(abc,a[j].name)==0) a[j].count++。}for(j=0。j6。j++) printf(“%s:%d\n”,a[j].name,a[j].count)。}include include define N 3struct student{ int stunum。 char stuname[10]。 int math。 int physics。int puter。 int sum。}。 void printspace( ){ int i。 for(i=0。i40。i++) printf(_)。 printf(\n)。} void printinformation(struct student stu[ ]){ int i。 printf(stuNum stuName math physics puter sum sort:\n)。 printspace( )。 for(i=0。iN。i++){ printf(%6d%10s%6d%6d%6d%6d,stu[i].stunum,stu[i].stuname,stu[i].math,stu[i].physics,stu[i].puter,stu[i].sum,i+1)。 printf(\n)。 } printspace( )。} void readinformation(struct student stu[ ]){ int i。 printf(Input %d student information:\n,N)。 for(i=0。iN。i++) { printf(Input the %d student stunum:,i+1)。 scanf(%d,amp。stu[i].stunum)。 printf(Input the %d student stuname:,i+1)。 scanf(%s,stu[i].stuname)。 printf(Input the %d student math score:,i+1)。 scanf(%d,amp。stu[i].math)。 printf(Input the %d student physics score:,i+1)。 scanf(%d,amp。stu[i].physics)。 printf(Input the %d student puter score:,i+1)。 scanf(%d,amp。stu[i].puter)。 stu[i].sum=stu[i].math+stu[i].physics+stu[i].puter。 }} void sortbystunum(struct student stu[ ]){ int i,j。 struct student t。 for(i=0。iN1。i++) for(j=0。jNi1。j++) if(stu[j].stunumstu[j+1].stunum) { t=stu[j]。 stu[j]=stu[j+1]。 stu[j+1]=t。 }} void sortbystuname(struct student stu[ ]){ int i,j。 struct student t。 for(i=0。iN1。i++) for(j=0。jNi1。j++) if(strcmp(stu[j].stuname,stu[j+1].stuname)0) { t=stu[j]。 stu[j]=stu[j+1]。 stu[j+1]=t。 }} void sortbymath(struct student stu[ ]){ int i,j。 struct student t。 for(i=0。iN1。i++) for(j=0。jNi1。j++) if(stu[j].mathstu[j+1].math) { t=stu[j]。 stu[j]=stu[j+1]。 stu[j+1]=t。 }} void sortbyphysics(struct student stu[ ]){ int i,j。 struct student t。 for(i=0。iN1。i++) for(j=0。jNi1。j++) if(stu[j].physicsstu[j+1].physics) { t=stu[j]。 stu[j]=stu[j+1]。 stu[j+1]=t。 }} void sortbyputer(struct student stu[ ]){ int i,j。 struct student t。 for(i=0。iN1。i++) for(j=0。jNi1。j++) if(stu[j].puterstu[j+1].puter) { t=stu[j]。 stu[j]=stu[j+1]。 stu[j+1]=t。 }} void sortbysum(struct student stu[ ]){ int i,j。 struct student t。 for(i=0。iN1。i++) for(j=0。jNi1。j++) if(stu[j].sumstu[j+1].sum) { t=stu[j]。 stu[j]=stu[j+1]。 stu[j+1]=t。 }} void sort(struct student stu[ ],int p){ switch(p) { case 1: sortbystunum(stu)。 break。 case 2: sortbystuname(stu)。 break。 case 3: sortbymath(stu)。 break。 case 4: sortbyphysics(stu)。 break。 case 5: sortbyputer(stu)。 break。 case 6: sortbysum(stu)。 break。 default: printf(thanks!\n)。 break。 }} void sortselect(int *select){ printf(\n\nplease select the num of sort !\n)。 printspace( )。 printf(1: stunum 2: stuname \n)。 printf(3: math 4: physics \n)。 printf(5: puter 6: sum \n)。 printf(0: exit! \n)。 printspace( )。 printf(“\nYour choice:”)。 scanf(%d,select)。} void main( ){ int selectnum。 struct student stu1[N]。 readinformation(stu1)。 sortselect(amp。selectnum)。 while(selectnum!=0) { sort(stu1,selectnum)。 printinformation(stu1)。 sortselect(amp。selectnum)。 }}include void main( ) { FILE *fp_in,*fp_out。 char infile[20],outfile[20]。 printf(“Enter the infile name:”)。 scanf(“%s”,infile)。 printf(“Enter the outfile name:”)。 scanf(“%s”,outfile)。 if((fp_in=fopen(infile,“r”)==NULL) { printf(“Can’t open file:%s”,infile)。 exit(1)。 } if((fp_out=fopen(outfile,“w”)==NULL) { printf(“Can’t open file:%s”,outfile)。 exit(1)。 } while(!feof(fp_in)) fputc(fgetc(fp_in),fp_out)。 fclose(fp_in)。 fclose(fp_out)。} include void main( ){ FILE *fp。char str[100]。int i。if((fp=fopen(“test”,“w”))==NULL){ printf(“Cannot open the file.\n”)。exit(0)。}printf(“Input a string:”)。gets(str)。 /*讀入一行字符串*/for(i=0。str[i]amp。amp。i100。i++) /*處理該行中的每一個字符*/{ if(str[i]=‘a(chǎn)’amp。amp。str[i]=‘z’) /*若是小寫字母*/str[i]=‘a(chǎn)’‘A’。 /*將小寫字母轉(zhuǎn)換為大寫字母*/fputc(str[i],fp)。 /*將轉(zhuǎn)換后的字符寫入文件*/}fclose(fp)。 /*關(guān)閉文件*/fp=fopen(“test”,“r”)。 /*以讀方式打開文本文件*/fgets(str,100,fp)。 /*從文件中讀入一行字符串*/printf(“%s\n”,str)。fclose(fp)。}
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)教案相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1