diff --git a/hello.cpp b/hello.cpp index 4f6a268..3a87b4c 100644 --- a/hello.cpp +++ b/hello.cpp @@ -1,7 +1,191 @@ -#include +#include using namespace std; -inrt main(){ -cout<<"hello world x"; -return 0; -} +int main() +{ + int n,bt[20],wt[20],tat[20],avwt=0,avtat=0,i,j,p[20],pos,temp; + cout<<"Enter total number of processes:\n"; + cin>>n; + cout<<"Enter a process: \n"<<"1. FCFS\n"<<"2. SJF\n"<<"3. Priority\n"<<"4. Round Robin\n"; + int x; + cin>>x; + switch(x) + { + case 1: + cout<<"Enter Process Burst Time\n"; + for(i=0;i>bt[i]; + } + wt[0]=0; + for(i=1;i>bt[i]; + p[i]=i+1; + } + for(i=0;i>bt[i]>>pr[i]; + p[i]=i+1; + } + for (i=0;i>at[count]; + cin>>bt[count]; + rt[count]=bt[count]; + count++; + } + cout<<"Enter Time Quantum: "; + cin>>quantum; + cout<<"\nProcess\t\tBurst Time\tWaiting Time\tTurnaround Time\n"; + min=at[0]; + for(i=1;i 0 ) + { + time+=rt[count]; + rt[count]= 0; + flag=1; + } + else if(rt[count]>0) + { + rt[count]-=quantum; + time+=quantum; + } + if(rt[count]==0&&flag==1) + { + remain--; + cout<