ok so I class telling a point to rotate 90 degrees till it reaching the original point.... I'm not using Visual Studio when it compiles just looks like crap..

#include <iostream>
#include "point.h"

using namespace std;

void rotate(point &p);

int Main()
{
  a.point(0,0);
  cout << "(" << a.get_x() << ", " << a.get_y() << ")\n";

  a.shift(2, -1);
  cout << "(" << a.get_x() << ", " << a.get_y() << ")\n";
}

int coutRotation(point p)
{
int rotations;
rotations = 0;
while ((a.get_x() 0 || (p.get_y() < 0))
   {
     a.rotate90();
     ++rotations;
    }
   return rotations
}

void rotate(point &p)
{

while ((a.get_x() < 0 || (p.get_y < 0))
  {
  a.rotate90:
  }
cout << '(: << a.get_x() << ", " << a.get_y() << ")/n
 }

I correct your VERY simple syntax mistake.
Here is correct code:

#include <iostream>
#include "point.h"

using namespace std;

void rotate(point &p);

int main()
{
  a.point(0,0);
  cout << "(" << a.get_x() << ", " << a.get_y() << ")\n";

  a.shift(2, -1);
  cout << "(" << a.get_x() << ", " << a.get_y() << ")\n";

  return 1;
}

int coutRotation(point p)
{
int rotations;
rotations = 0;
while ((a.get_x() 0 || (p.get_y() < 0))
   {
     a.rotate90();
     ++rotations;
    }
   return rotations;
}

void rotate(point &p)
{

while ((a.get_x() < 0 || (p.get_y < 0))
  {
  a.rotate90;
  }
cout << "(" << a.get_x() << ", " << a.get_y() << ")/n";
 }

I C++ when you use std write

cout<<"Bla bla bla"<<endl;//good style
cout<<"Bla bla bla\n";//bad style

This line here has an error in it:

while ((a.get_x() 0 || (p.get_y() < 0))

The first half of the OR condition is this:

a.get_x() 0

. I assume you want a comparison operator before the 0 such as =, <, >, etc.

You are also returning 1 instead of 0 at the end of your main function (that won't affect the compilation I don't think, but you probably want main to return 0). On your last line of the code you posted you have this:

cout << "(" << a.get_x() << ", " << a.get_y() << ")/n";

Your escape character is backwards. You want

\n

not

/n

Scratch that "return 1" comment in my last post. Got confused with zhelih's post I think. You're not returning anything in main. You want to return 0 from "int main". zhelih returned 1 from main in his post.

This article has been dead for over six months. Start a new discussion instead.