Exact problem listed in
void rotate(Point%26amp; p, double angle)
{
double new_x = (((p.get_x()*cos(angle))+(p.get_y()*sin(...
double new_y = (((-(p.get_x())*sin(angle))+(p.get_y()*c...
double dx = new_x- p.get_x();
double dy = new_y- p.get_y();
p.move(dx,dy);
}
void scale(Point%26amp; p, double scale)
{
double new_x = scale * p.get_x();
double new_y = scale * p.get_y();
double dx = new_x- p.get_x();
double dy = new_y- p.get_y();
p.move(dx,dy);
}
int main()
{
cout%26lt;%26lt; "The original point p (5,5) rotated 5 times by 10 degrees then scaled 5 times by .95 is:""\n";
Point p(5,5);
double angle = 10;
double scale = .95;
int rotation_count = 0;
int scale_count = 0;
while (rotation_count%26lt;5)
{
rotate(p, angle);
cout%26lt;%26lt; "The point is now " %26lt;%26lt; p.get_x() %26lt;%26lt; "," %26lt;%26lt; p.get_y()%26lt;%26lt; "\n";
rotation_count++;
}
cout%26lt;%26lt; "\n";
while (scale_count %26lt; 5)
{
scale(p, scale);
cout%26lt;%26lt; "The point is now " %26lt;%26lt; p.get_x() %26lt;%26lt; "," %26lt;%26lt; p.get_x()%26lt;%26lt; "\n";
scale_count++;
}
return 0;
}
I need help debugging my C++ program.?
you have an instance variable in main called scale and you are trying to call a method in main called scale(). can't do that...
double scale = .95;
...
scale(p, scale);
rename one of them (the instance variable is probably the easiest).
Reply:Dude,
I know this is rude, but do you have any idea as to how to convert data from CORD.x to double xval ?
what i am doing is that i am reading the coordinate form the mouse, using getmouspos() and the valuse that i get is CORD.x and CORD.y, using the POINT CORD. I can mail you my code if you wanna have a look at it...:-)
Any help will be appreciated.
ras
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment