#include<iostream>
using namespace std;
#include"stack"
void f1()
{
stack<int> s1;
for(int i = 0; i < 10; i++)
{
s1.push(i + 1);
}
cout << "栈的大小为: " << s1.size() << endl;
while (!s1.empty())
{
int temp = s1.top();
cout << temp << " ";
s1.pop();
}
}
class Person
{
public:
int age;
char name[20];
public:
void prinT()
{
cout << "age: " << age << endl;
}
};
void f2()
{
Person p1, p2, p3;
p1.age = 11;
p2.age = 12;
p3.age = 13;
stack<Person> p;
p.push(p1);
p.push(p2);
p.push(p3);
while(!p.empty())
{
Person temp = p.top();
temp.prinT();
p.pop();
}
}
int main()
{
f2();
return 0;
}