I have an assignment for a class that needs me to implement
I have an assignment for a class that needs me to implement FCFS
 I have the following data, I need some help setting this up
P1 {4,24,5,73,3,31,5,27,4,33,6,43,4,64,5,19,2}
 P2 {18,31,19,35,11,42,18,43,19,47,18,43,17,51,19,32,10}
 P3 {6,18,4,21,7,19,4,16,5,29,7,21,8,22,6,24,5}
 P4 {17,42,19,55,20,54,17,52,15,67,12,72,15,66,14}
 P5 {5,81,4,82,5,71,3,61,5,62,4,51,3,77,4,61,3,42,5}
 P6 {10,35,12,41,14,33,11,32,15,41,13,29,11}
 P7 {21,51,23,53,24,61,22,31,21,43,20}
 P8 {11,52,14,42,15,31,17,21,16,43,12,31,13,32,15}
Heres what I was thinking
struct process
 {
 public int[] process_size;
 public string[] process_id;
 public int[] arrival;
 public int[] cpu_burst;
 public int[] input_output_burst;
 public double[] wait;
 public double [] turnaround_time;
 public double []responsetime;
   
}
 void initialize_process ()
 {
 process p = new process();
 p.process_size = new int[8];
 //ARRIVAL TIMES
 p.arrival = new int[] { 4, 18, 6, 17, 5, 10, 21, 11};
 //initializes the id name
 p.process_id= new string[] {\"P1\",\"P2\",\"P3\",\"P4\",\"P5\",\"P6\",\"P7\",\"P8\"};
 //CPU BURSTS
 p.cpu_burst = new int[] { 38, 149, 52, 129, 41, 86, 131, 113};
 //I/O BURSTS
 p.input_output_burst = new int[] { 314, 324, 170, 408, 588, 211, 239, 252 };
FCFS(p);
   
}
 void FCFS(process p)
 {
 double average_wait;
 double average_turnaround_time;
 double average_response_time;
}
 public Form1()
 {
 InitializeComponent();
 }
private void calculate_Click(object sender, EventArgs e)
 {
 initialize_process();
 //FCFS();
}
Solution
Hope this will help-
#include<iostream>
 
 using namespace std;
 
 int main()
 {
     int n,bt[20],wt[20],tat[20],avwt=0,avtat=0,i,j;
     cout<<\"Enter total number of processes(maximum 20):\";
     cin>>n;
 
     cout<<\"\ Enter Process Burst Time\ \";
     for(i=0;i<n;i++)
     {
         cout<<\"P[\"<<i+1<<\"]:\";
         cin>>bt[i];
     }
 
     wt[0]=0;    //waiting time for first process is 0
 
     //calculating waiting time
     for(i=1;i<n;i++)
     {
         wt[i]=0;
         for(j=0;j<i;j++)
             wt[i]+=bt[j];
     }
 
     cout<<\"\ Process\\t\\tBurst Time\\tWaiting Time\\tTurnaround Time\";
 
     //calculating turnaround time
     for(i=0;i<n;i++)
     {
         tat[i]=bt[i]+wt[i];
         avwt+=wt[i];
         avtat+=tat[i];
         cout<<\"\ P[\"<<i+1<<\"]\"<<\"\\t\\t\"<<bt[i]<<\"\\t\\t\"<<wt[i]<<\"\\t\\t\"<<tat[i];
      }
 
     avwt/=i;
     avtat/=i;
     cout<<\"\ \ Average Waiting Time:\"<<avwt;
     cout<<\"\ Average Turnaround Time:\"<<avtat;
 
     return 0;
 }


