show(0),遞歸,if(00)不成立
安徽網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)!從網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、APP開(kāi)發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站項(xiàng)目制作,到程序開(kāi)發(fā),運(yùn)營(yíng)維護(hù)。成都創(chuàng)新互聯(lián)成立與2013年到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來(lái)保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選成都創(chuàng)新互聯(lián)。
不是退出 而是返回調(diào)用它的函數(shù)。
這就像 main調(diào)用show函數(shù),show函數(shù)完成后,它會(huì)返回main函數(shù)繼續(xù)執(zhí)行。
show(5) 調(diào)用 show(4) 調(diào)用show(3).....show(0)
然后 show(0) 執(zhí)行完了 返回 show(1) show(1) 執(zhí)行完了 返回show(2) .......一直返回到show(5),然后到main函數(shù) 然后程序結(jié)束。
簡(jiǎn)單的理解呢 是沒(méi)有明顯區(qū)別的 show是方法 visible是屬性;
show和visible都會(huì)觸發(fā)Form_Load()事件.
但是 show 后面還有個(gè)參數(shù)(0和1 一個(gè)模式窗體和無(wú)模式,這是很重要的功能,通常用在鎖定背景窗口時(shí)),visible則是隱藏和顯示 它后面是賦值的.
form2.show 1 '模式窗體,除了form2其它窗體被凍結(jié)
form2.unload '卸載窗體,而且會(huì)釋放內(nèi)存.也會(huì)觸發(fā)Form_QueryUnload()事件,
form2.visible=false'隱藏 但不會(huì)釋放內(nèi)存
同時(shí)還有form2.hide
show是對(duì)應(yīng)hide
從上可以看出它們的關(guān)鍵區(qū)別:內(nèi)存是否釋放
應(yīng)該是自定義函數(shù)和系統(tǒng)調(diào)用,如果方便的話給個(gè)最佳答案吧,謝謝
【1】這個(gè)是有的,如下示例:printf("%d\n",p-tm_sec); /*獲取當(dāng)前秒*/printf("%d\n",p-tm_min); /*獲取當(dāng)前分*/printf("%d\n",8+p-tm_hour);/*獲取當(dāng)前時(shí),這里獲取西方的時(shí)間,剛好相差八個(gè)小時(shí)*/printf("%d\n",p-tm_mday);/*獲取當(dāng)前月份日數(shù),范圍是1-31*/printf("%d\n",1+p-tm_mon);/*獲取當(dāng)前月份,范圍是0-11,所以要加1*/printf("%d\n",1900+p-tm_year);/*獲取當(dāng)前年份,從1900開(kāi)始,所以要加1900*/printf("%d\n",p-tm_yday); /*從今年1月1日算起至今的天數(shù),范圍為0-365。
【2】c語(yǔ)言:C語(yǔ)言是一種計(jì)算機(jī)程序設(shè)計(jì)語(yǔ)言,它既具有高級(jí)語(yǔ)言的特點(diǎn),又具有匯編語(yǔ)言的特點(diǎn)。它由美國(guó)貝爾研究所的D.M.Ritchie于1972年推出,1978年后,C語(yǔ)言已先后被移植到大、中、小及微型機(jī)上,它可以作為工作系統(tǒng)設(shè)計(jì)語(yǔ)言,編寫(xiě)系統(tǒng)應(yīng)用程序,也可以作為應(yīng)用程序設(shè)計(jì)語(yǔ)言,編寫(xiě)不依賴計(jì)算機(jī)硬件的應(yīng)用程序。它的應(yīng)用范圍廣泛,具備很強(qiáng)的數(shù)據(jù)處理能力,不僅僅是在軟件開(kāi)發(fā)上,而且各類科研都需要用到C語(yǔ)言,適于編寫(xiě)系統(tǒng)軟件,三維,二維圖形和動(dòng)畫(huà),具體應(yīng)用比如單片機(jī)以及嵌入式系統(tǒng)開(kāi)發(fā)。
void show()的意思是函數(shù)不返回任何值。去掉void后會(huì)是什么情況完全取決于編譯器??赡軋?bào)錯(cuò)。也可能和void show()一樣。也可能出現(xiàn)其它情況。因?yàn)椴皇敲恳粋€(gè)編譯器都完全實(shí)際標(biāo)準(zhǔn)的,而且這個(gè)標(biāo)準(zhǔn)也在修訂。所以void show()這樣才能保證它運(yùn)行良好。
修改以下代碼,我以前學(xué)習(xí)時(shí)學(xué)編的,相信你的智商!
#includestdio.h
#includestdlib.h
#includeconio.h
#includedos.h
#includestring.h
#define LEN sizeof(struct student)
#define FORMAT "%-8d%-15s%-12.1lf%-12.1lf%-12.1lf%-12.1lf\n"
#define DATA stu[i].num,stu[i].name,stu[i].elec,stu[i].expe,stu[i].requ,stu[i].sum
float Felec,Fexpe,Frequ;
struct student/*定義學(xué)生成績(jī)結(jié)構(gòu)體*/
{
int num;/*學(xué)號(hào)*/
char name[15];/*姓名*/
double elec;/*選修課*/
double expe;/*實(shí)驗(yàn)課*/
double requ;/*必修課*/
double sum;/*總分*/
};
struct student stu[50];/*定義結(jié)構(gòu)體數(shù)組*/
void in();/*錄入學(xué)生成績(jī)信息*/
void show();/*顯示學(xué)生信息*/
void order();/*按總分排序*/
void del();/*刪除學(xué)生成績(jī)信息*/
void modify();/*修改學(xué)生成績(jī)信息*/
void menu();/*主菜單*/
void insert();/*插入學(xué)生信息*/
void total();/*計(jì)算總?cè)藬?shù)*/
void search();/*查找學(xué)生信息*/
void main()/*主函數(shù)*/
{
int n;
menu();
scanf("%d",n);/*輸入選擇功能的編號(hào)*/
while(n)
{
switch(n)
{
case 1:
in();
break;
case 2:
search();
break;
case 3:
del();
break;
case 4:
modify();
break;
case 5:
insert();
break;
case 6:
order();
break;
case 7:
total();
break;
default:break;
}
getch();
menu();/*執(zhí)行完功能再次顯示菜單界面*/
scanf("%d",n);
}
}
void in()/*錄入學(xué)生信息*/
{
int i,m=0;/*m是記錄的條數(shù)*/
char ch[2];
FILE *fp;/*定義文件指針*/
if((fp=fopen("data","ab+"))==NULL)/*打開(kāi)指定文件*/
{
printf("can not open\n");
return;
}
while(!feof(fp))
{
if(fread(stu[m] ,LEN,1,fp)==1)
m++;/*統(tǒng)計(jì)當(dāng)前記錄條數(shù)*/
}
fclose(fp);
if(m==0)
printf("No record!\n");
else
{
system("cls");
show();/*調(diào)用show函數(shù),顯示原有信息*/
}
if((fp=fopen("data","wb"))==NULL)
{
printf("can not open\n");
return;
}
for(i=0;im;i++)
fwrite(stu[i] ,LEN,1,fp);/*向指定的磁盤文件寫(xiě)入信息*/
printf("please input(y/n):");
scanf("%s",ch);
if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)
{
printf("please input per centum:");
printf("\nelective:");
scanf("%f",Felec);
printf("\nexperiment:");
scanf("%f",Fexpe);
printf("\nrequired course:");
scanf("%f",Frequ);
}
while(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)/*判斷是否要錄入新信息*/
{
printf("number:");
scanf("%d",stu[m].num);/*輸入學(xué)生學(xué)號(hào)*/
for(i=0;im;i++)
if(stu[i].num==stu[m].num)
{
printf("the number is existing,press any to continue!");
getch();
fclose(fp);
return;
}
printf("name:");
scanf("%s",stu[m].name);/*輸入學(xué)生姓名*/
printf("elective:");
scanf("%lf",stu[m].elec);/*輸入選修課成績(jī)*/
printf("experiment:");
scanf("%lf",stu[m].expe);/*輸入實(shí)驗(yàn)課成績(jī)*/
printf("required course:");
scanf("%lf",stu[m].requ);/*輸入必修課成績(jī)*/
stu[m].sum=stu[m].elec*Felec+stu[m].expe*Fexpe+stu[m].requ*Frequ;/*計(jì)算出總成績(jī)*/
if(fwrite(stu[m],LEN,1,fp)!=1)/*將新錄入的信息寫(xiě)入指定的磁盤文件*/
{
printf("can not save!");
getch();
}
else
{
printf("%s saved!\n",stu[m].name);
m++;
}
printf("continue?(y/n):");/*詢問(wèn)是否繼續(xù)*/
scanf("%s",ch);
}
fclose(fp);
printf("OK!\n");
}
void show()
{
FILE *fp;
int i,m=0;
fp=fopen("data","ab+");
while(!feof(fp))
{
if(fread(stu[m] ,LEN,1,fp)==1)
m++;
}
fclose(fp);
printf("number name elective experiment required sum\t\n");
for(i=0;im;i++)
{
printf(FORMAT,DATA);/*將信息按指定格式打印*/
}
}
void menu()/*自定義函數(shù)實(shí)現(xiàn)菜單功能*/
{
system("cls");
printf("\n\n\n\n\n");
printf("\t\t|---------------------STUDENT-------------------|\n");
printf("\t\t|\t 0. exit |\n");
printf("\t\t|\t 1. input record |\n");
printf("\t\t|\t 2. search record |\n");
printf("\t\t|\t 3. delete record |\n");
printf("\t\t|\t 4. modify record |\n");
printf("\t\t|\t 5. insert record |\n");
printf("\t\t|\t 6. order |\n");
printf("\t\t|\t 7. number |\n");
printf("\t\t|-----------------------------------------------|\n\n");
printf("\t\t\tchoose(0-7):");
}
void order()/*自定義排序函數(shù)*/
{
FILE *fp;
struct student t;
int i=0,j=0,m=0;
if((fp=fopen("data","ab+"))==NULL)
{
printf("can not open!\n");
return;
}
while(!feof(fp))
if(fread(stu[m] ,LEN,1,fp)==1)
m++;
fclose(fp);
if(m==0)
{
printf("no record!\n");
return;
}
for(i=0;im-1;i++)
for(j=i+1;jm;j++)/*雙重循環(huán)實(shí)現(xiàn)成績(jī)比較并交換*/
if(stu[i].sumstu[j].sum)
{
t=stu[i];
stu[i]=stu[j];
stu[j]=t;
}
if((fp=fopen("data","wb"))==NULL)
{
printf("can not open\n");
return;
}
for(i=0;im;i++)/*將重新排好序的內(nèi)容重新寫(xiě)入指定的磁盤文件中*/
if(fwrite(stu[i] ,LEN,1,fp)!=1)
{
printf("%s can not save!\n");
getch();
}
fclose(fp);
printf("save successfully\n");
}
void del()/*自定義刪除函數(shù)*/
{
FILE *fp;
int snum,i,j,m=0;
char ch[2];
if((fp=fopen("data","ab+"))==NULL)
{
printf("can not open\n");
return;
}
while(!feof(fp))
if(fread(stu[m],LEN,1,fp)==1)
m++;
fclose(fp);
if(m==0)
{
printf("no record!\n");
return;
}
printf("please input the number:");
scanf("%d",snum);
for(i=0;im;i++)
if(snum==stu[i].num)
break;
if(i==m)
{
printf("can not find");
getchar();
return;
}
printf("find the student,delete?(y/n)");
scanf("%s",ch);
if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)/*判斷是否要進(jìn)行刪除*/
{
for(j=i;jm;j++)
stu[j]=stu[j+1];/*將后一個(gè)記錄移到前一個(gè)記錄的位置*/
m--;/*記錄的總個(gè)數(shù)減1*/
printf("delete successfully!\n");
}
if((fp=fopen("data","wb"))==NULL)
{
printf("can not open\n");
return;
}
for(j=0;jm;j++)/*將更改后的記錄重新寫(xiě)入指定的磁盤文件中*/
if(fwrite(stu[j] ,LEN,1,fp)!=1)
{
printf("can not save!\n");
getch();
}
fclose(fp);
}
void search()/*自定義查找函數(shù)*/
{
FILE *fp;
int snum,i,m=0;
char ch[2];
if((fp=fopen("data","ab+"))==NULL)
{
printf("can not open\n");
return;
}
while(!feof(fp))
if(fread(stu[m],LEN,1,fp)==1)
m++;
fclose(fp);
if(m==0)
{
printf("no record!\n");
return;
}
printf("please input the number:");
scanf("%d",snum);
for(i=0;im;i++)
if(snum==stu[i].num)/*查找輸入的學(xué)號(hào)是否在記錄中*/
{
printf("find the student,show?(y/n)");
scanf("%s",ch);
if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)
{
printf("number name elective experiment required sum\t\n");
printf(FORMAT,DATA);/*將查找出的結(jié)果按指定格式輸出*/
break;
}
else
return;
}
if(i==m)
printf("can not find the student!\n");/*未找到要查找的信息*/
}
void modify()/*自定義修改函數(shù)*/
{
FILE *fp;
int i,j,m=0,snum;
if((fp=fopen("data","ab+"))==NULL)
{
printf("can not open\n");
return;
}
while(!feof(fp))
if(fread(stu[m],LEN,1,fp)==1)
m++;
if(m==0)
{
printf("no record!\n");
fclose(fp);
return;
}
printf("please input the number of the student which do you want to modify!\n");
scanf("%d",snum);
for(i=0;im;i++)
if(snum==stu[i].num)/*檢索記錄中是否有要修改的信息*/
break;
if(im)
{
printf("find the student!you can modify!\n");
printf("please input per centum:");
printf("\nelective:");
scanf("%f",Felec);
printf("\nexperiment:");
scanf("%f",Fexpe);
printf("\nrequired course:");
scanf("%f",Frequ);
printf("name:\n");
scanf("%s",stu[i].name);/*輸入名字*/
printf("\nelective:");
scanf("%lf",stu[i].elec);/*輸入選修課成績(jī)*/
printf("\nexperiment:");
scanf("%lf",stu[i].expe);/*輸入實(shí)驗(yàn)課成績(jī)*/
printf("\nrequired course:");
scanf("%lf",stu[i].requ);/*輸入必修課成績(jī)*/
stu[i].sum=stu[i].elec*Felec+stu[i].expe*Fexpe+stu[i].requ*Frequ;
}
else
{
printf("can not find!");
getchar();
return;
}
if((fp=fopen("data","wb"))==NULL)
{
printf("can not open\n");
return;
}
for(j=0;jm;j++)/*將新修改的信息寫(xiě)入指定的磁盤文件中*/
if(fwrite(stu[j] ,LEN,1,fp)!=1)
{
printf("can not save!");
getch();
}
fclose(fp);
}
void insert()/*自定義插入函數(shù)*/
{
FILE *fp;
int i,j,k,m=0,snum;
if((fp=fopen("data","ab+"))==NULL)
{
printf("can not open\n");
return;
}
while(!feof(fp))
if(fread(stu[m],LEN,1,fp)==1)
m++;
if(m==0)
{
printf("no record!\n");
fclose(fp);
return;
}
printf("please input position where do you want to insert!(input the number)\n");
scanf("%d",snum);/*輸入要插入的位置*/
for(i=0;im;i++)
if(snum==stu[i].num)
break;
for(j=m-1;ji;j--)
stu[j+1]=stu[j];/*從最后一條記錄開(kāi)始均向后移一位*/
printf("now please input the new information.\n");
printf("number:");
scanf("%d",stu[i+1].num);
for(k=0;km;k++)
if(stu[k].num==stu[i+1].numk!=i+1)
{
printf("the number is existing,press any to continue!");
getch();
fclose(fp);
return;
}
printf("please input per centum:");
printf("\nelective:");
scanf("%f",Felec);
printf("\nexperiment:");
scanf("%f",Fexpe);
printf("\nrequired course:");
scanf("%f",Frequ);
printf("name:\n");
scanf("%s",stu[i+1].name);
printf("\nelective:");
scanf("%lf",stu[i+1].elec);
printf("\nexperiment:");
scanf("%lf",stu[i+1].expe);
printf("\nrequired course:");
scanf("%lf",stu[i+1].requ);
stu[i+1].sum=stu[i+1].elec*Felec+stu[i+1].expe*Fexpe+stu[i+1].requ*Frequ;
if((fp=fopen("data","wb"))==NULL)
{
printf("can not open\n");
return;
}
for(k=0;k=m;k++)
if(fwrite(stu[k] ,LEN,1,fp)!=1)/*將修改后的記錄寫(xiě)入磁盤文件中*/
{
printf("can not save!");
getch();
}
fclose(fp);
}
void total()
{
FILE *fp;
int m=0;
if((fp=fopen("data","ab+"))==NULL)
{
printf("can not open\n");
return;
}
while(!feof(fp))
if(fread(stu[m],LEN,1,fp)==1)
m++;/*統(tǒng)計(jì)記錄個(gè)數(shù)即學(xué)生個(gè)數(shù)*/
if(m==0)
{
printf("no record!\n");
fclose(fp);
return;
}
printf("the class are %d students!\n",m);/*將統(tǒng)計(jì)的個(gè)數(shù)輸出*/
fclose(fp);
}
分享題目:c語(yǔ)言show函數(shù)功能,show函數(shù)作用
網(wǎng)站網(wǎng)址:http://chinadenli.net/article40/dsiehho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供小程序開(kāi)發(fā)、網(wǎng)站制作、微信小程序、響應(yīng)式網(wǎng)站、ChatGPT、靜態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)