c++ 关于操作系统的

来源:百度知道 编辑:UC知道 时间:2024/05/30 18:23:17
struct Program {
char name[8];
struct Step *step;
};
struct Step{
char resourceName[8];
int during;
struct Step * next;
};
struct Resource {
char name[8];
int currentProgram; int change;
struct Wait *wait;
};

struct Wait{
int programID;
struct Wait *next;
};
Promgram program[3];
Resource resource[3];
int timer;
struct Wait *o,* p,*q;
int i,j,t,s;
timer = 0;
i=0;
while(i<3){
j=0;
while(j<3){
if((program[i].step)->resourceName==resource[j].name)
break;
j++;
}
if(resource[j].currentProgram>0){
struct Wait *o = (struct Wait *)malloc(sizeof(struct Wait));
p->programID = i;
p->next = NULL;

q = NULL;
p = resource[j].wait;
while(p!=NULL){
q = p;
p=p->next;
}

#include<stdlib.h> //for malloc

struct Step{
char resourceName[8];
int during;
struct Step * next;
};
struct Program {
char name[8];
struct Step *step;
};

struct Wait{
int programID;
struct Wait *next;
};

struct Resource {
char name[8];
int currentProgram;
int change;
struct Wait *wait;
};

int main(void) //此处添加
{
struct Program program[3];//此处改正
struct Resource resource[3];
int timer;
struct Wait * p,*q;
int i,j,t,s;
timer = 0;
i=0;
while(i<3){
j=0;
while(j<3){
if((program[i].step)->resourceName==resource[j].name)
break;
j++;
}
if(resource[j].currentProgram>0){
struct Wait *o = (struct Wait *)malloc(sizeof(struct Wait));
p->programID = i;
p->next = NULL;

q = NULL;
p = resource[j].wait;
while(p!=NULL){
q = p;