//调度算法的模拟
//1.FCFS
#include<stdio.h>
#include <malloc.h>
#include <string>
#include <string.h>
#include<iostream>
using namespace std;
struct PCB{
string name;//进程name
int reachTime;//标志进程到达时间
int needTime;//进程所需的时间
bool state;
/*进程的状态,false表示挂起,true表示激活*/
int alltime;//总共所用的时间,即周转时间
bool over; //进程的状态,true表示结束
}P[5]; //声明5个进程
void init();
void processSchedule();
void printPCB(PCB P);
int main(){
init(); //初始化这五个进程
processSchedule();//进程调度
cout<<"进程名称"<<"\t"<<"到达时间"<<"\t"<<"所需时间"<<"\t"<<"周转时间"<<endl;
for(int i = 0; i < 5; i++){
printPCB(P[i]); //打印进程信息
}
return 0;
}
void init(){
P[0].name = "P1";
P[0].reachTime = 0;
P[0].needTime = 4;
P[0].state = 0;
P[0].alltime = 0;
P[0].over