completion time added
This commit is contained in:
parent
bb8c9edb9f
commit
824a7ef5fd
@ -2,7 +2,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct sjf{
|
struct sjf{
|
||||||
int burst, arrival, id;
|
int burst, arrival, id, completion;
|
||||||
bool active;
|
bool active;
|
||||||
};
|
};
|
||||||
sjf meh[30];
|
sjf meh[30];
|
||||||
@ -48,6 +48,7 @@ public:
|
|||||||
meh[iddd].burst--;
|
meh[iddd].burst--;
|
||||||
k++;
|
k++;
|
||||||
if(meh[iddd].burst == 0){
|
if(meh[iddd].burst == 0){
|
||||||
|
meh[iddd].completion = k;
|
||||||
completed++;
|
completed++;
|
||||||
}
|
}
|
||||||
} else{
|
} else{
|
||||||
@ -55,11 +56,20 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void completion()
|
||||||
|
{
|
||||||
|
cout<<"\n\n | Completion time\n";
|
||||||
|
for(int j = 0; j < n; j++) {
|
||||||
|
cout<<"P"<<j<<"| "<<meh[j].completion<<"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
lesgo obj;
|
lesgo obj;
|
||||||
obj.sjfIn();
|
obj.sjfIn();
|
||||||
obj.sjfProcess();
|
obj.sjfProcess();
|
||||||
|
obj.completion();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user