#include <iostream>using namespace std; int main() { // your code goes here cout << f(5, {1,2,3,4,5}, 5); return 0;} double f(int n, int arr[], int x){ double cur = arr[n-1]; for(int i=n-1; i>0; i++){ cur = cur*x + arr[i-1] } return cur;}
Standard input is empty
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 } ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!