fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. using namespace std;
  5.  
  6. int main() {
  7. const int maxn = 10;
  8. int position[maxn] = {0};
  9. int arr[] = {3, 2, 6, 4};
  10. const int sz = static_cast<int>(sizeof arr / sizeof arr[0]);
  11. for(int i = 0; i < sz; ++i) position[ arr[i] ] = i + 1;
  12. for(int i = 0; i < maxn; ++i) if(position[i]) cout << ' ' << position[i];
  13. return 0;
  14. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
 2 1 4 3