Main.cc: In function 'int main()': Main.cc:7:20: error: 'n' was not declared in this scope for(int x=i;x<=n;++x) ^