fork download
  1. typedef std::pair<int, int> action;
  2.  
  3. std::vector<action> actions{
  4. { sf::Keyboard::Left, Direction::LEFT},
  5. { sf::Keyboard::Up, Direction::UP},
  6. { sf::Keyboard::Right, Direction::RIGHT},
  7. { sf::Keyboard::Down, Direction::DOWN}
  8. };
  9.  
  10. for (auto const &a : actions)
  11. if (sf::Keyboard::IsKeyPressed(a.first)) {
  12. snake.move(a.second, snakeMap);
  13. break;
  14. }
  15.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:9: error: ‘pair’ in namespace ‘std’ does not name a type
 typedef std::pair<int, int> action;
         ^
prog.cpp:3:1: error: ‘vector’ in namespace ‘std’ does not name a type
 std::vector<action> actions{
 ^
prog.cpp:10:1: error: expected unqualified-id before ‘for’
 for (auto const &a : actions)
 ^
stdout
Standard output is empty