fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. cout << f(5, {1,2,3,4,5}, 5);
  8. return 0;
  9. }
  10.  
  11.  
  12. double f(int n, int arr[], int x){
  13. double cur = arr[n-1];
  14. for(int i=n-1; i>0; i++){
  15. cur = cur*x + arr[i-1]
  16. }
  17. return cur;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:7:29: error: ‘f’ was not declared in this scope
  cout << f(5, {1,2,3,4,5}, 5);
                             ^
prog.cpp: In function ‘double f(int, int*, int)’:
prog.cpp:16:2: error: expected ‘;’ before ‘}’ token
  }
  ^
stdout
Standard output is empty