fork download
  1. #include <string>
  2. #include <vector>
  3.  
  4. class Entity
  5. {
  6. std::string name;
  7. int alive;
  8. int attack;
  9. float defence;
  10. int hp;
  11.  
  12. public:
  13. void fight(Entity &e) {}
  14. };
  15.  
  16. class Army
  17. {
  18. std::vector<Entity> entities;
  19. std::string name;
  20.  
  21. public:
  22. void fight(Army &);
  23. };
  24.  
  25. void Army::fight(Army &a)
  26. {
  27. for(auto i = entities.begin(); i != entities.end(); ++i) {
  28. for(auto j = a.entities.begin(); j != a.entities.end(); ++j) {
  29. i->fight(*j);
  30. }
  31. }
  32. }
  33.  
  34. #include <iostream>
  35.  
  36. int main(void) {
  37. std::cout << "asdasf" << std::endl;
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
asdasf