fork download
  1. #include <vector>
  2. #include <iostream>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. uint32_t toInt(vector<int> v)
  8. {
  9. uint32_t x=0;
  10. for(int i=0 ; i<v.size() ; i++)
  11. x+=v[i]*pow(10, v.size()-1-i);
  12.  
  13. return x;
  14. }
  15.  
  16. int main()
  17. {
  18. vector<int> v = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  19. cout << toInt(v) << endl; // displays: 123456787 (???)
  20. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
123456789