Main.cc: In function 'int main()': Main.cc:9:3: error: 'a' was not declared in this scope a[j]=s[i]-48; ^ Main.cc:14:11: error: 'a' was not declared in this scope ans=ans+a[i]*pow(2,i); ^