没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
typedef struct node
{
char name[10];
int prio;
int round;
int cputime;
int needtime;
int count;
char state;
struct node *next;
}pcb;
pcb *finish,*ready,*tail,*run;
int N;
void firstin()
{
run=ready;
run->state='R';
ready=ready->next;
}
char toUpper(char a)
{
if(a>='a'&&a<='z')
return(a-32);
else
return a;
}
void prt1(char a)
#include"stdlib.h"
#include"string.h"
typedef struct node
{
char name[10];
int prio;
int round;
int cputime;
int needtime;
int count;
char state;
struct node *next;
}pcb;
pcb *finish,*ready,*tail,*run;
int N;
void firstin()
{
run=ready;
run->state='R';
ready=ready->next;
}
char toUpper(char a)
{
if(a>='a'&&a<='z')
return(a-32);
else
return a;
}
void prt1(char a)
{
if(toUpper(a)=='P')
printf("进程号 cpu时间 所需时间 优先数 状态\n");
else if(toUpper(a)=='F')
printf("进程号 cpu时间 所需时间 状态\n");
}
void prt2(char a,pcb *q)
{
if(toupper(a)=='P')
printf(" % -10s% -10d% -10d% -10d %c\n",q->name,q->cputime,q->needtime,q->prio,q->state);
else
printf(" % -10s% -10d% -10d % -c\n",q->name,q->cputime,q->needtime,q->state);
}
void prt(char algo)
{
pcb *p;
prt1(algo);
if(run!=0)
prt2(algo,run);
p=ready;
while(p!=0)
{
prt2(algo,p);
p=p->next;
}
p=finish;
while(p!=0)
{
if(toUpper(a)=='P')
printf("进程号 cpu时间 所需时间 优先数 状态\n");
else if(toUpper(a)=='F')
printf("进程号 cpu时间 所需时间 状态\n");
}
void prt2(char a,pcb *q)
{
if(toupper(a)=='P')
printf(" % -10s% -10d% -10d% -10d %c\n",q->name,q->cputime,q->needtime,q->prio,q->state);
else
printf(" % -10s% -10d% -10d % -c\n",q->name,q->cputime,q->needtime,q->state);
}
void prt(char algo)
{
pcb *p;
prt1(algo);
if(run!=0)
prt2(algo,run);
p=ready;
while(p!=0)
{
prt2(algo,p);
p=p->next;
}
p=finish;
while(p!=0)
{
剩余7页未读,继续阅读
资源评论
JingWu77
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功