//this program converts a string to binary number and displays it
#include
#include
#include
#include
void main()
{
clrscr();
char ch[20],a;
int len=0,total[100],i=0,pp=0;
cout<<"enter the string: ";
gets(ch);
len=strlen(ch);
for(i=0;i
{ i=0;
a=ch[i];
pp=a;
while(pp!=0)
{ if((pp%2)==0)
{ total[i]=0;
i++;
}
else
{ total[i]=1;
i++;
}
pp=pp/2;
}
}
i--;
for(int k=i;k>=0;k--)
{ cout<
getch();
}
//eg-- input a
// output-- 100001
but i m not getting the proper output...tried hard but nothings helping....so i need ur help!
2007-02-25
21:12:39
·
3 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design