fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int points[2], counter = 1;
  8.  
  9. // Read in first point:
  10. cin >> points[0];
  11.  
  12. // Read until we meet our condition:
  13. do {
  14. cin >> points[counter];
  15. // toggle counter between 0 and 1
  16. counter = (counter + 1) % 2;
  17.  
  18. cout << "Checking: " << points[0] << " == " << points[1] << endl;
  19.  
  20. // Check if we are done:
  21. } while (points[0] != points[1]);
  22. cout << "They were!\n";
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 3472KB
stdin
1
2
3
4
5
6
7
8
9
10
10
stdout
Checking: 1 == 2
Checking: 3 == 2
Checking: 3 == 4
Checking: 5 == 4
Checking: 5 == 6
Checking: 7 == 6
Checking: 7 == 8
Checking: 9 == 8
Checking: 9 == 10
Checking: 10 == 10
They were!