急!急!急!C++中的queue
#ifndef RUNWAY_H
#define RUNWAY_H
#include "Plane.h " // Plane.h里面定义了Plane这个类
#include <queue>
enum Runway_activity{idle, land, take_off};
enum Error_code{fail, success};
class Runway
{
public:
Runway(int limit);
Error_code can_land(const Plane& current);
Error_code can_depart(const Plane& current);
Runway_activity activity(int time, Plane& moving);
void shut_down(int time) const;
private:
queue <Plane> landing;
queue <Plane> takeoff;
int queue_limit;
int num_land_requests;
};
#endif // RUNWAY_H ///
谢谢!!!!
为什么在编译的时候在queue <Plane> landing;和queue <Plane> takeoff;这一行会出现错误:
error C2143: 语法错误 : 缺少“;”(在“ <”的前面)
error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 interror error C2238: 意外的标记位于“;”之前
是在visual studio 2005上编译的
[解决办法]
std::queue <Plane> landing;
std::queue <Plane> takeoff;
[解决办法]
加一句using namespace std;
stl的都在std名字空间里的