| Back to Questions Page |
| |
| Question |
what is the use of using for loop as "for(;;)"? |
Rank |
Answer Posted By |
|
Question Submitted By :: Jephin |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Infinite loop  |
| San |
| |
| |
| Answer | Evaluates the whole loop to be true infinite  |
| Lalitha |
| |
| |
| Answer | for using first inisilization;second test counter;third
increment/decrement
int i;
syntax: for(i=0;i<=100;i++)  |
| Arun N Patil |
| |
| |
|
|
| |
| Question |
A Binary no. is given, we hav to find it's decimal
equivalent. |
Rank |
Answer Posted By |
|
Question Submitted By :: Itgeet |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | include<stdio.h>
include<conio.h>
void main()
{
int n,x,a,i;
printf("ENTER THE DECIMAL NO");
scanf("%d'&n);
for(i=2;i<=n;i++)
x=n%2;
a=x/2;
printf("binary %d",a);
getch();
}  |
| Bunker |
| |
| |
| Question |
1.program to add any two objects using operator overloading
2.program to add any two objects using constructors
3.program to add any two objects using binary operator
4.program to add any two objects using unary operator |
Rank |
Answer Posted By |
|
Question Submitted By :: Nithya |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | /*Program to add two object using operator overloading */
/* vikas */
#include<iostream.h>
#include<string.h>
#include<stdio.h>
#include<conio.h>
class Stadd
{
private:
char p[20];
public:
void set(char *k)
{
strcpy(p,k);
}
Stadd operator+(Stadd c)
{
Stadd l;
strcpy(l.p,p);
strcat(l.p,c.p);
return l;
}
void display()
{
cout<<"The string is = "<<p;
}
};
void main()
{
char m[]="vikas";
char n[]="kumar";
Stadd ws,wt,wu;
ws.set(m);
wt.set(n);
wu=ws+wt;
wu.display();
getch();
}  |
| Vikas |
| |
| |
| Question |
#include<iostream.h>
//main()
//{
class A
{
friend class B;
public:
void read();
};
class B
{
public :
int a,b;
};
void A::read()
{
cout<<"welcome";
}
main()
{
A x;
B y;
y.read();
}
In the above program......,
as B is a friend of A B can have access to all members,i
cant access y.read .
could you please tell me the reason and what would i code
to execute this program? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | write a program to larger of two number by using friend
function in c++  |
| Manzoor |
| |
| |
| Answer | declare friend class b under public  |
| Nn |
| |
| |
|
| |
|
Back to Questions Page |