fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. vector<int> arr(10);
  9. arr[1] = 1;
  10. arr[2] = 2;
  11.  
  12. int x = 1;
  13. arr[++x] += arr[x];
  14.  
  15. cout << x << " " << arr[x];
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
2 3