#include <malloc.h>
#include <stdio.h>
typedef struct
{
char name[10];//进程名
int id;//进程id
int atime;//到达时间
int stime;//开始时间
int runtime;//运行时间
int ftime;//完成时间
float total;//周转时间
float weight;//带权周转时间
}PCB;
typedef struct _Node
{
struct _Node* next;
PCB pcb;
}node;
struct node* creat()
{
node* head = malloc(sizeof(node));
head->next = NULL;
node* move = head;
printf("请输入进程数量:\n");
int count;
scanf("%d", &count);
for (int i = 0; i < count; i++)
{
node* fresh = malloc(sizeof(node));
fresh->next = NULL;
move->next = fresh;
printf("请输入第%d个进程的id、到达时间、运行时间:\n", i + 1);
scanf("%d%s%d%d", &fresh->pcb.id, fresh->pcb.name, &fresh->pcb.atime, &fresh->pcb.runtime);
move = fresh;
}
return head;
}
void fcfs(node* head) {
for (node* turn = head->next; turn->next != NULL; turn =
fcfs算法 c语言
于 2023-04-01 15:29:55 首次发布