Monday, May 24, 2010

Need help fixing my C++ program.?

I need help getting my program to compile.





...


void rotate(Point%26amp; p, double angle)


{


double new_x = (((p.get_x()*cos(angle))


+(p.get_y()*sin(angle))));


double new_y = (((-(p.get_x())*sin(angle))


+(p.get_y()*cos(angle))));


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_x %26lt;%26lt; "\n";


rotation_count++;


}


...


This is the error I recieve


Error 1 error C3867: 'Point::get_x': function call missing argument list; use '%26amp;Point::get_x' to create a pointer to member d:\my documents\visual studio 2005\projects\a3q2\a3q2\assgn3q2.cpp 52





line 52 : cout%26lt;%26lt; "The point is now " %26lt;%26lt; p.get_x %26lt;%26lt; "," %26lt;%26lt; p.get_x %26lt;%26lt; "\n"

Need help fixing my C++ program.?
you forgot the parenthesis on the method calls:





line 52 : cout%26lt;%26lt; "The point is now " %26lt;%26lt; p.get_x %26lt;%26lt; "," %26lt;%26lt; p.get_x %26lt;%26lt; "\n"





should be:





line 52 : cout%26lt;%26lt; "The point is now " %26lt;%26lt; p.get_x() %26lt;%26lt; "," %26lt;%26lt; p.get_x() %26lt;%26lt; "\n"





-devon


No comments:

Post a Comment