GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Algorithm.cpp/fcfs.cpp at master · bappasahabapi/Algorithm.cpp

Expand file tree

/

fcfs.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
59 lines (46 loc) · 1.23 KB
/

fcfs.cpp

Copy path

File metadata and controls

59 lines (46 loc) · 1.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<iostream>
using namespace std;
int main()
{
int n_process ,bt[20], wt[20], tat[20], avwt=0, avtat=0,avct =0, i, j;
int ct[20];
cout<<"Enter total number of processes(maximum 20):";
cin>>n_process;
cout<<"\nEnter Process Burst Time\n";
for(i=0; i<n_process ;i++)
{
cout<<"Process["<<i+1<<"]:";
cin>>bt[i];
}
wt[0]=0; //waiting time for first process is 0
//calculating waiting time
for(i=1;i<n_process;i++)
{
wt[i]=0;
for(j=0; j<i; j++)
wt[i]+=bt[j];
}
//compleating time
for(i=0; i<n_process; i++)
{
ct[i]= bt[i];
for(j=0; j<i; j++)
ct[i]+=bt[j];
}
cout<<"\nProcess\t\tBurst Time\tWaiting Time\tTurnaround Time\tCompleating Time\t ";
//calculating turnaround time
for(i=0; i<n_process; i++)
{
tat[i]=bt[i]+wt[i];
avwt+=wt[i];
avtat+=tat[i];
avct+=ct[i];
cout<<"\nP["<<i+1<<"]"<<"\t\t"<<bt[i]<<"\t\t"<<wt[i]<<"\t\t"<<tat[i]<<"\t\t"<<ct[i];
}
avwt/=i;
avtat/=i;
cout<<"\n\nAverage Waiting Time:"<<avwt;
cout<<"\nAverage Turnaround Time:"<<avtat;
cout<<"\nAverage Compleating Time:"<<avct<<endl;
return 0;
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.