File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+
4
+ int main ()
5
+ {
6
+ int no_of_process,temp;
7
+ float sum=0 ;
8
+ cout<<" enter no of process : " ;
9
+ cin>>no_of_process;
10
+ int *arrival_time=new int (no_of_process);
11
+ int *compilation_time=new int (no_of_process);
12
+ cout<<" now enter arrival time of all process : " ;
13
+ for (int i=0 ;i<no_of_process;i++)
14
+ {
15
+ cin>>arrival_time[i];
16
+ }
17
+ cout<<" now enter burst time of all process : " ;
18
+ for (int i=0 ;i<no_of_process;i++)
19
+ {
20
+ cin>>temp;
21
+ sum=sum+temp;
22
+ // I directly compute compilation time.
23
+ compilation_time[i]=sum;
24
+ }
25
+ cout<<" Now T.A.time of each process is : " ;
26
+ sum=0 ;
27
+ for (int i=0 ;i<no_of_process;i++)
28
+ {
29
+ cout<<(compilation_time[i]-arrival_time[i])<<" " ;
30
+ sum=sum+compilation_time[i]-arrival_time[i];
31
+ }
32
+ cout<<" \n Average T.A time time is : " <<sum/no_of_process<<endl;
33
+ cout<<" Now wating time of each process is : " ;
34
+ sum=0 ;
35
+ for (int i=0 ;i<no_of_process;i++)
36
+ {
37
+ cout<<(compilation_time[i-1 ]-arrival_time[i])<<" " ;
38
+ sum=sum+compilation_time[i-1 ]-arrival_time[i];
39
+ }
40
+ cout<<" \n Now average wating time of all process is : " <<sum/no_of_process<<endl;
41
+ }
You can’t perform that action at this time.
0 commit comments