Hi friends,
I am trying to find the decimal form of a binary number and I have done till here and am not able to detect where I am going wrong .
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,arr[20],ar[20],sum=0;
cout<<"enter the digits in the decimal form";
cin>>a;
cout<<"enter the number in decimal form";
for(int i=0;i<=a;i++)
{
cin>>arr[i];
}
for(int j=a-1;j>=0;j--)
{
ar[i]=(arr[i]*2)^j;
sum=sum+ar[i];
}
cout<<sum;
getch();
}Can anybody help..???