Compiler error "lvalue required as left operand of assignment"

  1. After trying to compile code error is given Lvalue required as left operand of assignment.

  2. Relevant commands, code, scripts, algorithms:
    if , else if

  3. The attempts at a solution (include all code and scripts):

/*
  File: incircles.cpp
  Created by: James Selhorst
  Creation Date:09/14/12
  Synopsis:  This program reads in three circles and a query point 
  and reports which circles contain the query point.
*/

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
  double x1,y1,x2,y2,x3,y3,x4,y4,a,b,c,dx1,dy1,dx2,dy2,dx3,dy3; // Variable declarations


  
  
  cout<<"Enter x and y coordinates of circle A (2 values):";// prompt and read in circle A center coordinates
  cin>>x1>> y1;
  cout<<"Enter radius of circle A:"; // prompt and read in circle A radius
  cin>>a;
  cout<<"Enter x and y coordinates of circle B (2 values):"; // promt and read in circle B center coordinates
  cin>>x2>>y2;
  cout<<"Enter radius of circle B:"; // prompt and read in circle B radius
  cin>>b;
  cout<<"Enter x and y coordinates of circle C (2 values):"; // prompt and read in circle C center coordinates
  cin>>x3>>y3;
  cout<<"Enter radius of circle C:"; // prompt and read in circle C radius
  cin>>c;
  cout<<"Enter x and y coordinates of query point (2 values):"; // prompt and read in query point
  cin>>x4>>y4;

  dx1=(x4-x1);
  dy1=(y4-y1);
  dx2=(x4-x2);
  dy2=(y4-y2);
  dx3=(x4-x3);
  dy3=(y4-y3);

  if ((sqrt((dx1*dx1)+(dy1*dy1))<=a),(sqrt((dx2*dx2)+(dy2*dy2))<=b),(sqrt((dx3*dx3)=(dy3*dy3))<=c))
    {
      cout<<"Circles A B and C contain point ("<<x4<<","<<y4<<")."<<endl;
    }
  else if ((sqrt((dx1*dx1)+(dy1*dy1))>=a),(sqrt((dx2*dx2)+(dy2*dy2))<=b),(sqrt((dx3*dx3)=(dy3*dy3))<=c))
    {
      cout<<"Circles B and C contain point ("<<x4<<","<<y4<<")."<<endl;
    }
  else if ((sqrt((dx2*dx2)+(dy2*dy2))>=b),(sqrt((dx1*dx1)+(dy1*dy1))<=a),(sqrt((dx3*dx3)=(dy3*dy3))<=c))
    {
      cout<<"Circles A and C contain point ("<<x4<<","<<y4<<")."<<endl;
    }
  else if ((sqrt((dx3*dx3)=(dy3*dy3))>=c),(sqrt((dx1*dx1)+(dy1*dy1))<=a),(sqrt((dx2*dx2)+(dy2*dy2))<=b))
    {
      cout<<"Circles A and B contain point ("<<x4<<","<<y4<<")."<<endl;
    }
  else if ((sqrt((dx1*dx1)+(dy1*dy1))>=a),(sqrt((dx2*dx2)+(dy2*dy2))>=b),(sqrt((dx3*dx3)=(dy3*dy3))>=c))
    {
      cout<<"No circle contains points ("<<x4<<","<<y4<<")."<<endl;
    }
 else if ((sqrt((dx1*dx1)+(dy1*dy1))>=a),(sqrt((dx2*dx2)+(dy2*dy2))>=b),(sqrt((dx3*dx3)=(dy3*dy3))<=c))
   {
     cout<<"Circle C contains points ("<<x4<<","<<y4<<")."<<endl;
   }
 else if ((sqrt((dx1*dx1)+(dy1*dy1))>=a),(sqrt((dx3*dx3)=(dy3*dy3))>=c),(sqrt((dx2*dx2)+(dy2*dy2))<=b))
   {
     cout<<"Circle B contains points ("<<x4<<","<<y4<<")."<<endl;
   }
 else if ((sqrt((dx2*dx2)+(dy2*dy2))>=b),(sqrt((dx3*dx3)=(dy3*dy3))>=c),(sqrt((dx1*dx1)+(dy1*dy1))<=a))
   {
     cout<<"Circle A contains points ("<<x4<<","<<y4<<")."<<endl;   
   }
     


  // Determine location of query point relative to the circles

  return 0;
}

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

The ohio state university, columbus ohio, USA, YI wang, CSE 1222

Hello, i am trying to compile this code that i put in above and i cant seem to fix the issue of why i keep getting this stupid error. Can anyone help please. The error is on every line that has the if or else if statement, im just not sure how to fix it.

You have an assignment in the final sqrt calculation of each conditional. Looks like a typo.

Regardless, your code will not give you the correct result. The comma-operator is not a logical-AND.

I suggest that you do all the distance calculations at the beginning, storing the results in variables. It will make the if-statements much more compact and readable. And it will also save on pointless recalculation of unchanging quantities.

Regards,
Alister

Just to make the error plain:

else if ((sqrt((dx2*dx2)+(dy2*dy2))>=b),(sqrt((dx3*dx3)=(dy3*dy3))>=c),(sqrt((dx1*dx1)+(dy1*dy1))<=a))

I should point out, though, that == doesn't work very well with floating point either. It will be extremely picky. Is 3.000001 equal to 3.000002? No. Only 3.0000001000 will be exactly the same as 3.0000001000. There's also the problem that the same number can appear in several different ways in floating point.

So don't check if floats are equal. Check if they're "close enough" by subtracting them, taking the absolute value, and seeing if the result is less than the maximum distance apart you want:

#include <math.h>

bool isequal(double a, double b, double accuracy)
{
        return(fabs(a-b)<=accuracy);
}

int main(void)
{
        double a=9.00001, b=9.00002;
        cout << "Equal to 0.00000001 precision? " << isequal(a, b,   0.00000001) <<endl;
        cout << "Equal to 0.0001 precision? " << isequal(a, b,   0.0001) << endl;
}