fork download
  1. #include <iostream>
  2. #include <iostream>
  3.  
  4.  
  5. template<size_t N>
  6. int accumulate( const int (&arr)[N] )
  7. {
  8. int result = arr[0];
  9. for(size_t n = 1; n < N; ++n)
  10. result = result * 10 + arr[n];
  11. return result;
  12. }
  13.  
  14.  
  15. int main()
  16. {
  17. std::cout << "Hello, world!\n";
  18.  
  19. int myints[] = {7, 40, 5, 3, 0};
  20.  
  21. int a; // //Хочу чтобы a = 740530;
  22.  
  23. a = accumulate(myints);
  24. //вот ведь незадача
  25. std::cout<<"result = "<< a<< '\n';
  26.  
  27. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
Hello, world!
result = 110530