# Newbie programmer, few quick questions...

• 10-29-2005
cjmdjm
Newbie programmer, few quick questions...
I have just started learning C/C++. As practice i started doing a few challenge exercises. I am working on one such exercise in which i must write a program which can decide if three given points form an isosceles triangle (triangle with at least 2 congruent sides, for math illiterates). This is done by first making sure the points are not collinear (form a straight line) and then checking if the distance between any two points is the same. But i get a couple strange errors when compiling. I'm pretty sure the math is right. Anyway here is the code (d12 is distance between point 1 and 2, d13 = distance between point 1 and 3, you get it.):

Code:

```#include <iostream> using namespace std; int main() {     int x1, y1, x2, y2, x3, y3, d12, d23, d13;     bool is_collinear;     is_collinear = 0;     cout << "Enter x1";     cin >> x1;     cin.ignore();     cout << "Enter y1";     cin >> y1;     cin.ignore();     cout << "Enter x2";     cin >> x2;     cin.ignore();     cout << "Enter y2";     cin >> y2;     cin.ignore();     cout << "Enter x3";     cin >> x3;     cin.ignore();     cout << "Enter y3";     cin >> y3;     cin.ignore();     d12 = (((x1 - x2)^2) + ((y1 - y2)^2));     d13 = (((x1 - x3)^2) + ((y1 - y3)^2));     d23 = (((x2 - x3)^2) + ((y2 - y3)^2));     if  ((y2 - y1) * (x3 - x1)) == ((y3 - y1) * (x2 - x1))     {         is_collinear = 1;     }     if ((is_collinear == 0) && ((d12 == d23) || (d12 == d13) || (d23 == d13)))     {         cout << "It is an isosceles triangle!";     }     else     {         cout << "It's not an isosceles triangle.";     }     cin.get(); }```
when attempting to compile i get the following errors. Syntax error before '==' token on line 30 (first IF statement) and syntax error before '.' token on cin.get() function at global scope. I have no idea whats wrong. I have torn through many tutorials and as far as i can see there is nothing wrong with the code. What is wrong? BTW, i am using DevC++ 5. Thanx!
• 10-29-2005
SlyMaelstrom
Try this:
Code:

`if  ((y2 - y1) * (x3 - x1) == (y3 - y1) * (x2 - x1))`