diff --git a/Codes/Group B/Assignment - 5/SJF (Premptive).cpp b/Codes/Group B/Assignment - 5/SJF (Premptive).cpp new file mode 100644 index 0000000..42ce415 --- /dev/null +++ b/Codes/Group B/Assignment - 5/SJF (Premptive).cpp @@ -0,0 +1,65 @@ +#include +using namespace std; + +struct sjf{ + int burst, arrival, id; + bool active; +}; +sjf meh[30]; + +class lesgo{ +public: + int n; + + void sjfIn(){ + cout<<"\nEnter number of processes: "; + cin>>n; + for(int i = 0; i < n; i++){ + cout<<"\nEnter arrival time of P"<>meh[i].arrival; + cout<<"\nEnter burst time of P"<>meh[i].burst; + meh[i].id = i; + meh[i].active = false; + } + cout<<"\n | Arrival | Burst\n"; + for(int j = 0; j < n; j++) { + cout<<"P"< 0){ + if(meh[i].burst < burst1){ + burst1 = meh[i].burst; + iddd = i; + } + } + } + if(iddd != -1){ + cout<<"P"<