Below is my source code, it won't compile and says that there is a Microsoft Run-Time error (1.#IND), can anyone help me out? Thanks!

/*Program: hwassign3.cpp
Author: Melissa Hubbard
Date: January, 31, 2005
Purpose: This program was designed to take information from a user and
    perform the quadradic equation Ax^2+Bx+C=0 and give the two roots of
    the equation.
*/
#include "stdafx.h"
#include <cmath>
#include<iostream>
using namespace std;

int main (){

double A,B,C; /*variables to get from user*/
double xpos; /*used to get positive answer*/
double xneg; /*used to get negative answer*/



cout<<"Please enter the number that represent A: ";
cin>>A;
cout<<"Please enter the number that represent B: ";
cin>>B;
cout<<"Please enter the number that represent C: ";
cin>>C;

if ((A=0)||(((B*B-4*A*C))<=0));

else 
{
xpos=((-B+sqrt((B*B)-4*A*C))/(2*A));
cout<<"The positive answer is: " <<xpos;
xneg=((-B-sqrt((B*B)-4*A*C))/(2*A));
cout<<"The negative answer is: " <<xneg;
}
system("PAUSE");
return 0;
}

Edited 3 Years Ago by pyTony: fixed formating

I don't get a warning, but this is what I am trying to do-->verify that A (not equal) to 0, B*B-4AC>=0...can you help me in forming this parameter?

Dividing by zero?

if ( (A=0)||(((B*B-4*A*C))<=0) );

This assigns 0 to A. Doesn't your compiler give you a warning?

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