
C++里怎么使用自带的queue?
#include"stdafx.h"#include<queue>#include<string>usingnamespacestd;intmain(intargc,ch...
#include "stdafx.h"
#include <queue>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
queue q;
return 0;
}
这个哪里错了?为什么我加了头文件还是用不了自带的queue? 展开
#include <queue>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
queue q;
return 0;
}
这个哪里错了?为什么我加了头文件还是用不了自带的queue? 展开
1个回答
展开全部
queue是模板类,用的时候要加模板参数的。
比如,你想定义一个整数队列,就用queue<int> q;
如果想定义一个字符串队列,就用queue<string> q;
比如,你想定义一个整数队列,就用queue<int> q;
如果想定义一个字符串队列,就用queue<string> q;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询