#include<iostream>
#include<cstdlib>
#include<fstream>
using namespace std;
int main()
{ int n=3;
float total,wait[3]={0};
float p[3],twaiting=0,waiting=0;
int proc;
int stack[3];
float burst[3],arrival[3],sburst,temp[3],top=3;
for(int i=0;i<n;i++)
{
p[i]=i;
stack[i]=i;
cout<<"Enter arival time : ";
cin>>arrival[i];
cout<<endl<<"Enter burst time: ";
cin>>burst[i];
temp[i]=arrival[i];
sburst=burst[i]+sburst;
for(i=0;i<sburst;i++)
{
proc=stack[0];
if(temp[proc]==i)
{
//temp[proc]=i+1;;
twaiting=0;
}
else
{
twaiting=i-(temp[proc]);
}
temp[proc]=i+1;
wait[proc]=wait[proc]+twaiting;
waiting=waiting+(twaiting);
burst[proc]=burst[proc]-1;
if(burst[proc]==0)
{
for(int x=0;x<top-1;x++)
{
stack[x]=stack[x+1];
}
top=top-1;
for(int z=0;z<top-1;z++)
{
if((burst[stack[0]]>burst[stack[z+1]]) && (arrival[stack[z+1]] <= i+1))
int t=stack[0];
stack[0]=stack[z+1];
stack[z+1]=t;
}
}
}
cout<<"waiting:"<<waiting;
return 0;
}
}
}
There is a little problem at line 57. It says that the t is nt declared. I assume it that i need to insert a header file like <stdlib>.Please help me