So I'm kinda lost on how will I create a code or even a formula of how to get the average time of a round robin scheduling and its turn over time here is my code in round robin can anyone please give me some tips? in how to improve my codes? and how to get the average waiting time?
#include<iostream>
using namespace std;
int main(){
int number;
int interval;
cout<<"How many Process Need: ";
cin>>number;
cout<<"Time Quantum: ";
cin>>interval;
int array[number];
for(int i=0;i<number;i++)
{
cout<<"Process Time for Job "<<i+1<<": ";
cin>>array[i];
}
for(int z=0;z<number;z++)
{
for(int i=0;i<number;i++)
{
if(array[i]-interval>=interval-1)
{
for(int x=1;x<=interval;x++)
{
cout<<"Job "<<i+1<<"\t";
}
array[i]=array[i]-interval;
}
else
{
for(int x=1;x<=array[i];x++)
{
cout<<"Job "<<i+1<<"\t";
}
array[i]=0;
}
}
}
cout<<endl;
system("pause");
return 0;
}