%s",p[k].name); } printf("\n进程信息:\n"); printf("\nname\tarrive\tservice\tstart\tfinish\tzz\tdqzz\n"); for(k=0;k<=N-1;k++) { printf("%s\t%-.2f\t%-.2f\t%-.2f\t%-.2f\t%-.2f\t%-.2f\t\n",p[k].name,p[k].arrivetime,p[k].servicetime,p[k].starttime,p[k].finishtime,p[k].zztime,p[k].dqzztime); } } //按到达时间排序 void sort(struct zgxyb *p,int N) { int i,j; for(i=0;i<=N-1;i++) for(j=0;j<=i;j++) if(p[i].arrivetime=p[k].arrivetime) { p[k].starttime=p[k-1].finishtime;} else { p[k].starttime =p[k].arrivetime;} p[k].finishtime=p[k].starttime+p[k].servicetime; } p[k].zztime=p[k].finishtime-p[k].arrivetime; p[k].dqzztime=p[k].zztime/p[k].servicetime; } } void ZGXYB(struct zgxyb *p,int N) { float arrivetime=0,servicetime=0,starttime=0,finishtime=0,zztime=0,dqzztime=0; int m,i,n,follow,k; float max; struct zgxyb temp; sort(p,N); for(m=0;m=p[m].arrivetime ) { p[m].starttime=p[m-1].finishtime;} else { p[m].starttime =p[m].arrivetime;} p[m].finishtime=p[m].starttime+p[m].servicetime; } } i=0; for(n=m+1;n<=N-1;n++) { if(p[n].arrivetime<=p[m].finishtime) i++; } max=(p[m].finishtime-p[m+1].arrivetime)/p[m+1].servicetime; follow=m+1; for(k=m+1;k