//round robin #include<stdio.h> #include #include struct process { int pid; int atime; int wtime; int left; int btime; int ttime; int finish; }pro[5]; int i=0; int finish() { int j; for(j=0;j>choice; if(choice==1) { cout<<"Process id:"; cin>>pro[i].pid; cout<<"Arrival time:"; cin>>pro[i].atime; cout<<"Burst time:"; cin>>pro[i].btime; pro[i].left=pro[i].btime; pro[i].finish=0; i++; } }while(choice==1);
clrscr(); cout<<"Gauntt Chart\n"; int tslice=4; int s=0; int flag; int totaltime=0; int j,c; do { flag=1; for(j=0;jtslice) { pro[j].left=pro[j].left-tslice; totaltime+=tslice; for(int d=0;d
} }//end of for if(flag==1) { c=finish(); if(c!=1) { textcolor(i); cprintf("%c",char(219)); totaltime++; chart[s++]='i'; }
} }while(c!=1);
}
chart[s]='\0'; cout<<endl; for(int k=0;k<s;k++) { cout<
Related Documents