Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. /**
  9. * CodinGame planet is being attacked by slimy insectoid aliens.
  10. * <---
  11. * Hint:To protect the planet, you can implement the pseudo-code provided in the statement, below the player.
  12. **/
  13. int main()
  14. {
  15.  
  16. // game loop
  17. while (1) {
  18. string enemy1; // name of enemy 1
  19. cin >> enemy1; cin.ignore();
  20. int dist1; // distance to enemy 1
  21. cin >> dist1; cin.ignore();
  22. string enemy2; // name of enemy 2
  23. cin >> enemy2; cin.ignore();
  24. int dist2; // distance to enemy 2
  25. cin >> dist2; cin.ignore();
  26.  
  27. if (dist1 < dist2)
  28. cout << enemy1 << endl;
  29. else
  30. cout << enemy2 << endl;
  31.  
  32.  
  33. // Write an action using cout. DON'T FORGET THE "<< endl"
  34. // To debug: cerr << "Debug messages..." << endl;
  35.  
  36. cout << "name of the enemy" << endl; // You have to output a correct ship name to shoot ("Buzz", enemy1, enemy2, ...)
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement