c改c++,不能运行了!!!跪求为什么!

来源:百度知道 编辑:UC知道 时间:2024/06/23 11:54:14
#include<iostream.h>
using namespace std;
#define error 0
#define N 3
#define OVERFLOE -1
#include<stdlib.h>
#include "math.h"
#include<stdio.h>
#include "conio.h"
FILE *fp;
int m=0;int z=0,v=0,d=0;
typedef struct PCB
{
int id;
struct PCB *next;
int yxs;
int cput;
int time;
int status; /*0表wait,1表run,2表finish */
} PCB,*queueptr;
typedef struct
{ queueptr front;
queueptr rear ;
} linkqueue;

int initqueue(linkqueue *q)
{
q->front=q->rear=(queueptr)malloc(sizeof(PCB));
if(!q->front)exit(OVERFLOW);
q->front->next=NULL;
printf("used initqueue %d time\n",++d);<

以下程序在g++下编译通过(仅编译,没链接),修改了#include <iostream>,和struct定义新类型的部分

楼上,不需要向量容器的。

#include<iostream>
using namespace std;
#define error 0
#define N 3
#define OVERFLOE -1
#include<stdlib.h>
#include "math.h"
#include<stdio.h>
#include "conio.h"
FILE *fp;
int m=0;int z=0,v=0,d=0;
struct PCB
{
int id;
PCB *next;
int yxs;
int cput;
int time;
int status; /*0表wait,1表run,2表finish */
} ;

typedef PCB* queueptr;

struct linkqueue
{ queueptr front;
queueptr rear ;
};

int initqueue(linkqueue *q)
{
q->front=q->rear=(queueptr)malloc(sizeof(PCB));
if(!q->front)exit(OVERFLOW);
q->front->next=NULL;
printf("used initqueue %d time\n",++d);
return 1;
}
int enqueue (linkqueue *q,int e1,int e2,int e3,int