fork download
  1. #include <cstdio>
  2. #include <vector>
  3. class Person{
  4. public:
  5. int age;
  6. int weight;
  7. Person(int age, int weight):age(age), weight(weight){}
  8. };
  9. int main() {
  10. std::vector<Person> ls;
  11. ls.push_back(Person(20, 160));
  12. ls.push_back(Person(25, 180));
  13. ls.push_back(Person(23, 170));
  14. for(auto i=ls.begin();i!=ls.end();++i){
  15. printf("%X %X %d %d\n", &i, &(*i), (*i).age, (*i).weight);
  16. }
  17. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
BFFA1F28 8CD3030 20 160
BFFA1F28 8CD3038 25 180
BFFA1F28 8CD3040 23 170