Doubt in binary to decimal program

this code works on other compiler but not on coding blocks
#include
using namespace std;
//problem 2- quadratic equation

int main() {
//problem 5-binary to decimal
int n,no=0;
cin>>n;
if(n>0 and n<=1000000000)
for(int i=1;i<=10n;i=2){
no+=i*(n%10);
n=n/10;
}
cout<<no<<endl;
return 0;
}

but when i change my code to

#include using namespace std; int main() { //problem 5-binary to decimal int n,no=0,base=1; cin>>n; if(n>0 and n<=1000000000) for(int i=1;i<=10n;i++){ no+=base(n%10); base*=2; n=n/10; } cout<<no<<endl; return 0; }

hey @akshat2806 please share your code throught ide.codingblocks.com