Answer to Question #12589 in C++ for sofiya sabri

Question #12589
find error
# include <iostream.h>
class xyz
{
private:
int d1;
float d2;
public:
void xyz ()
void display ();
};
void main ()
{
xyz s;
s.showdata();
}
1
Expert's answer
2012-08-09T07:42:19-0400
There should be implementation of the methods used:

#include
<iostream>
using namespace std;
class xyz
{
private:
int
d1;
float d2;
public:
xyz ()
{
d1 = 3;
d2 =
3.14159f;
}

void display ()
{
cout << "d1 = " << d1
<< endl << "d2 = " << d2 << endl;
}
};

int
main ()
{
xyz s;
s.display ();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS