You are not logged in.

#1 2015-05-26 05:58:46

hasnain
Administrator
From: Chichawatni
Registered: 2014-10-13
Posts: 8,355
Website

Code Snippet Assuming:

Question:
What is the output of the following code snippet assuming user enters the side as 4?

class square
{
public:
double side1;
double area()
{
return(side1*side1);
}
};

int main(){
double area1=0;
square c1,c2;
cout << "Enter the length of the square" << endl;
cin >> c1.side;
cout << "The area of the square is : " << c1.area1() << endl;
return(0);
}

Option A):
16
Option B):
Will result in an error
Option C):
8
Option D):
12

Correct Answer is Option B):
Will result in an error


Failure is the first step towards seccess.

2015-05-26 05:58:46

Advertisement
Ads By Google

Re: Code Snippet Assuming:



Board footer