#include<iostream>
using namespace std;
#include"vector"
#include"algorithm"
void f1()
{
vector<int> v1;
v1.push_back(1);
v1.push_back(3);
v1.push_back(5);
for (vector <int>::iterator it = v1.begin(); it != v1.end(); it++)
{
cout << *it << " ";
}
int numl = count (v1.begin(), v1.end(), 3);
cout << "numl:" << numl << endl;
}
class Teacher
{
public:
int age;
char name[64];
public:
void prinT()
{
cout << "age:" << age << endl;
}
};
void f2()
{
Teacher t1, t2, t3;
t1.age = 31;
t2.age = 32;
t3.age = 33;
vector<Teacher> v1;
v1.push_back(t1);
v1.push_back(t2);
v1.push_back(t3);
for (vector <Teacher>::iterator it = v1.begin(); it != v1.end(); it++)
{
cout << it->age << " ";
}
}
void f3()
{
Teacher t1, t2, t3;
t1.age = 31;
t2.age = 32;
t3.age = 33;
Teacher *p1, *p2, *p3;
p1 = &t1;
p2 = &t2;
p3 = &t3;
vector<Teacher *> v1;
v1.push_back(p1);
v1.push_back(p2);
v1.push_back(p3);
for (vector <Teacher *>::iterator it = v1.begin(); it != v1.end(); it++)
{
cout << (**it).age << " ";
}
}
int main()
{
f3();
return 0;
}