饮料自动贩卖机赚钱吗:如何调用函数

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/02 07:22:01
……#define N 1000
…………
printf("Input choice0:");
scanf("%d",&choice0);
switch(choice0)
{ case 1: voidloads(struct studentp[N]);break;
case 2:
allocate(void);break;
case 3:
voidloadt(struct teachert[M]);break;
case 4:
printf("the way you can search are as follows(1-3): "); printf("1. search by name\n");
printf("2. search by number\n");
printf("3. search by subjects\n");
printf("Input choice:");
scanf("%d",&choice);
if(choice==1) printf("Plese input name : ");
scanf("%s", &name); chazhaoname(name);break;

if(choice==2) printf("Plese input number : ");
scanf("%d", &number); chazhaonumber(number);
break;
if(choice==3) printf("Plese input subject : ");
scanf("%s", &subject); chazhaosubject(subject);
break;
case 5:
printf……
}
}

struct student{ …… }p[N];

struct teacher{ ……}t[M];

voidloads(struct student p[N])
{ int i,j,k;
struct p[N], temp;
for(i=0,i<N,i++)
{ flushall(); gets(p[i].name);
scanf(“……”)

for(i=0,i<N,i++) { k=i;
for(j=i+1,i<N,j++)
if(p[j].score>p[k].score) k=j;
temp=p[i];
p[i]=p[k]; p[k]=temp;
}
}
}

allocate(void) { int i,q,j,k=1;
for(i=0,i<N,i++)
{ for(j=i+1,j<N,j++)
if(strcmp(p[i].subject,p[j].subject)==0)
p[i].number=1; k++;
p[j].number=k;
while(k<=35)
{ q=1;
p[i].class=q;
q++;
}

}

voidloadt(struct teachert[M]) {
struct teacher t[M];
for(i=0,i<M,i++)
{ flushall(); gets(t[i].name);
scanf…… randmize;
for(i=0,i<q,i++)
t[m].classNo=rand(q);
}

chazhaoname(char name) {
{…… }

chazhaonumber(int number) { ……
}

chazhaosubject( char subject) {
…… }

prin(void) { ……}

问题说清楚点嘛,调用函数就是用函数名调用啊,你究竟是想做什么,写那么大段

biology