void testqueue()
{
typedef struct person
{
people(string name,int age)
{
this->name=name;
this->age=age;
}
string name;
int age;
}Person;
queue q;
Person p1={"1", 999};
Person p2={"2", 888};
Person p3={"3", 900};
Person p4={"4", 99};
Person p5={"5", 500};
q.push(p1);
q.push(p2);
q.push(p3);
q.push(p4);
q.push(p5);
while (q.empty() != 1)
{ //队头
cout << "name " << q.front().name << " age " << q.front().age << " " << endl;
//队尾 感觉看这个队尾没什么意义,只能先进先出,又不能两边一起进,两边一起出。。
// cout << "name " << q.back().name << " age " << q.back().age << " " << endl;
//出队,先进先出,队列进出。
q.pop();
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QApplication::setQuitOnLastWindowClosed(true);
testqueue();
return a.exec();
}