标签:
#include "iostream"
#include "queue"
using namespace std;
void main12()
{
queue <int> q;
for (int i = 0; i < 5; i++)
{
q.push(i);
}
while (!q.empty())
{
int temp = q.front();
cout << temp << endl;
q.pop();
}
system("pause");
}
struct Teacher
{
int age;
char name[10];
};
void printf_queue(queue<Teacher *>&q)
{
while (!q.empty())
{
Teacher* temp = q.front();
cout << temp->age << endl;
q.pop();
}
}
void main()
{
queue<Teacher *>q;
Teacher t1, t2, t3;
t1.age = 11;
t2.age = 22;
t3.age = 33;
q.push(&t1);
q.push(&t2);
q.push(&t3);
printf_queue(q);
system("pause");
}
标签:
原文地址:http://www.cnblogs.com/panda88/p/4759058.html