Main.cc: In function 'int main()': Main.cc:13:9: error: 'i' was not declared in this scope sum+=a[i]*n; ^