What's wrong with this code?
Try to compile test 1 & 2. Here''s the link. I renamed it to jpg because that''s the only thing my upload service will let me upload. So just right click download and rename to zip.
http://www.boomspeed.com/hellyeah17/Dunno.jpg
hard to right click it without linx0ring it.
P.S. - pasting what your problem is, code, error messages, etc. will help ellicit constructive responses. most people won't waste their time responding to a "here's my program, it doesn't work, what's wrong?" post.
[edited by - retard on January 14, 2004 9:23:50 PM]
P.S. - pasting what your problem is, code, error messages, etc. will help ellicit constructive responses. most people won't waste their time responding to a "here's my program, it doesn't work, what's wrong?" post.
[edited by - retard on January 14, 2004 9:23:50 PM]
TEST 1
// Fig. 9.7: fig09_07.cpp
// Demonstrate when base-class and derived-class
// constructors and destructors are called.
#include
#include "point2.h"
#include "circle2.h"
int main()
{
// Show constructor and destructor calls for Point
{
Point p( 11, 22 );
}
cout << endl;
Circle circle1( 4.5, 72, 29 );
cout << endl;
Circle circle2( 10, 5, 5 );
cout << endl;
return 0;
}
TEST 2
// Fig. 9.10: fig09_10.cpp
// Driver for class Cylinder
#include
#include "point2.h"
#include "circle2.h"
#include "cylindr2.h"
int main()
{
// create Cylinder object
Cylinder cyl( 5.7, 2.5, 12, 23 );
// use get functions to display the Cylinder
cout << "X coordinate is " << cyl.getX()
<< "\nY coordinate is " << cyl.getY()
<< "\nRadius is " << cyl.getRadius()
<< "\nHeight is " << cyl.getHeight() << "\n\n";
// use set functions to change the Cylinder''s attributes
cyl.setHeight( 10 );
cyl.setRadius( 4.25 );
cyl.setPoint( 2, 2 );
cout << "The new location, radius, and height of cyl are:\n"
<< cyl << ''\n'';
cout << "The area of cyl is:\n"
<< cyl.area() << ''\n'';
// display the Cylinder as a Point
Point &pRef = cyl; // pRef "thinks" it is a Point
cout << "\nCylinder printed as a Point is: "
<< pRef << "\n\n";
// display the Cylinder as a Circle
Circle &circleRef = cyl; // circleRef thinks it is a Circle
cout << "Cylinder printed as a Circle is:\n" << circleRef
<< "\nArea: " << circleRef.area() << endl;
return 0;
}
// Fig. 9.7: fig09_07.cpp
// Demonstrate when base-class and derived-class
// constructors and destructors are called.
#include
#include "point2.h"
#include "circle2.h"
int main()
{
// Show constructor and destructor calls for Point
{
Point p( 11, 22 );
}
cout << endl;
Circle circle1( 4.5, 72, 29 );
cout << endl;
Circle circle2( 10, 5, 5 );
cout << endl;
return 0;
}
TEST 2
// Fig. 9.10: fig09_10.cpp
// Driver for class Cylinder
#include
#include "point2.h"
#include "circle2.h"
#include "cylindr2.h"
int main()
{
// create Cylinder object
Cylinder cyl( 5.7, 2.5, 12, 23 );
// use get functions to display the Cylinder
cout << "X coordinate is " << cyl.getX()
<< "\nY coordinate is " << cyl.getY()
<< "\nRadius is " << cyl.getRadius()
<< "\nHeight is " << cyl.getHeight() << "\n\n";
// use set functions to change the Cylinder''s attributes
cyl.setHeight( 10 );
cyl.setRadius( 4.25 );
cyl.setPoint( 2, 2 );
cout << "The new location, radius, and height of cyl are:\n"
<< cyl << ''\n'';
cout << "The area of cyl is:\n"
<< cyl.area() << ''\n'';
// display the Cylinder as a Point
Point &pRef = cyl; // pRef "thinks" it is a Point
cout << "\nCylinder printed as a Point is: "
<< pRef << "\n\n";
// display the Cylinder as a Circle
Circle &circleRef = cyl; // circleRef thinks it is a Circle
cout << "Cylinder printed as a Circle is:\n" << circleRef
<< "\nArea: " << circleRef.area() << endl;
return 0;
}
why do u have a random #include at the top?
btw, the [.source] [./source] tags (without the .) are the prefered way for ppl to post large(ish) amounts of code, for small sections the [.code] [./code] tags are the other option
btw, the [.source] [./source] tags (without the .) are the prefered way for ppl to post large(ish) amounts of code, for small sections the [.code] [./code] tags are the other option
What''s wrong? You are too lazy, that''s what is wrong. How about at least telling us what the error is?!
I would love to get my teeth wet and help you out. I see sevreal problems with your code already. However you need to format your output of it on this board correctly, and then you need to compile it and using the apropiate tags - let us know the compilation errors.
I don''''t believe in signatures, they are a waste of time and I would never consider having one.
I don''''t believe in signatures, they are a waste of time and I would never consider having one.
I know what''s wrong with it. What do you thinks wrong with it and why?
For example
1) It won''t compile and gives the errors...
For example
1) It won''t compile and gives the errors...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement