Good day, I need help with my code. It's very simple and I was compiling it successfully at school, but at home I'm having problems with it.
Here is the code.


#include <cmath>
#include <iostream>
#include <conio.h>
using namespace std; 
int main ()
float a, b, c; 
cout « "Enter a" «endl; 
cin » a;
cout « "Enter b" «endl; 
cin » b; 
cout « "Enter c" «endl; 
cin » c; 
if (abs(a-c) == abs(a-b))
cout « "On the same length" « endl; 
else if (abs(a-b) < abs(a-c)) 
cout « "Point B is closer, AC = " « abs(a-c) « ", but AB = " « abs(a-b) « endl;
else if (abs(a-b) > abs(a-c))
cout « "Point C is closer, AB = " « abs(a-b) « ", but AC = " « abs(a-c) « endl; 

Spot the difference time:

« vs <<
» vs >>

The one on the left is not C++ code. The one on the right is. This is what happens when you copy and paste code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.