avadh.786
BAN USER
Comments (4)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
int bin[20] = {0};
int dec = 0, rem = 0;
int i = 1;
cout<<"\n**** Converting a Decimal no to Binary ****\n";
cout<<"\n Enter the Decimal no: ";
cin>>dec;
while(dec>0){
rem = dec%2;
if(rem==1) //Case for odd numbers
bin[20] = 1;
bin[20-i] = rem;
dec = dec/2;
i++;
}
cout<<"\n No in Binary is: ";
for(int j=0; j<20; j++)
cout<<bin[j];
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
class A {
- avadh.786 September 29, 2010X *x;
Y *y;
Z *z;
A(){
x = new X;
y = new Y;
z = new (nothrow)Z;
}
'nothrow' is a special object defined in header <new>. If the memory allocation fails for Z, instead of throwing a bad_alloc exception (which must be handled), 'new' returns back a NULL pointer and continues the execution of the program.