#include<iostream.h>
#include<conio.h>
class conversion
{
private:
int n,i,p,q;
int arr[23],ar[23],a[23];
public:
void input()
{
cout<<"how many binary nos you want to enter? ";
cin>>n;
cout<<endl<<endl;
p=0;
n--;
for(i=n;i>=0;i--)
{cout<<"enter binary no ";
cin>>arr[i];
p++;}
}
void func()
{
n=1;
for(i=0;i<=p;i++)
{ar[i]=n;
n=n*2;}
}
void output()
{ p--;
for(int j=0;j<=p;j++)
{
a[j]=arr[j]*ar[j];
}
q=0;
for(int j=0;j<=p;j++)
q=q+a[j];
cout<<endl<<endl;
cout<<"decimal conversion "<<q;
}
};
void main()
{
conversion c;
c.input();
c.func();
c.output();
getch();
}
#include<conio.h>
class conversion
{
private:
int n,i,p,q;
int arr[23],ar[23],a[23];
public:
void input()
{
cout<<"how many binary nos you want to enter? ";
cin>>n;
cout<<endl<<endl;
p=0;
n--;
for(i=n;i>=0;i--)
{cout<<"enter binary no ";
cin>>arr[i];
p++;}
}
void func()
{
n=1;
for(i=0;i<=p;i++)
{ar[i]=n;
n=n*2;}
}
void output()
{ p--;
for(int j=0;j<=p;j++)
{
a[j]=arr[j]*ar[j];
}
q=0;
for(int j=0;j<=p;j++)
q=q+a[j];
cout<<endl<<endl;
cout<<"decimal conversion "<<q;
}
};
void main()
{
conversion c;
c.input();
c.func();
c.output();
getch();
}
nothing happened..
ReplyDelete:(
what are you try to say me i am understand ?????
Deletenothing happened..
ReplyDelete:)