HELP ME SOON!!!PLEASE

still badly need help

Page 1 of 1

3 Replies - 927 Views - Last Post: 22 May 2001 - 08:59 PM Rate Topic: -----

#1 Kimbo420  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-May 01

HELP ME SOON!!!PLEASE

Posted 22 May 2001 - 07:48 AM

Alright I still need help with the discriminant thing.Here's
some code.
Ax^2+Bxy+Cy^2+Dx+Ey+F=0
z=b*b-(4*a*c)
if (z>0)
{
cout<<"Discriminant equals"<<z<<"2 real roots and the graph is Hyperbola";}
if (z=0)
{cout<<"Disc. equals"<<z<<"21 real root and the graph parabola";}
AND SO ON
PLEASE help me I don't know how to get this to work!!!I have to turn in my final today!!!!!

Is This A Good Question/Topic? 0
  • +

Replies To: HELP ME SOON!!!PLEASE

#2 EnKRYpTeD  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 128
  • Joined: 11-May 01

Re: HELP ME SOON!!!PLEASE

Posted 22 May 2001 - 07:58 AM

[color=red]
Ok, i can answer since you did try on that, i know how much you need the help. I had this same program im not going to tell you who i be tho ;) Ok, its very simple you have the main idea for your equasion but try taking out the parenthasies(sp) like this b*b-4*a*c now, tell me whats wrong and why it wont work or what it is doing. heres a lil more that might help

try putting the cout for the discriminant above the if statements like this
cout<<"The discriminant =<<z<<endl;

if(z<0)
cout<<"blabla
";
if (z>0)
cout<<"blabla
";
//have else be if z=0 i had a problem until i did this
else
cout<<"blabla"; post again ill reply quick, just tryin to help ;)

Was This Post Helpful? 0
  • +
  • -

#3 malkiri  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 3
  • View blog
  • Posts: 364
  • Joined: 29-March 01

Re: HELP ME SOON!!!PLEASE

Posted 22 May 2001 - 08:28 AM

The only thing I can see is that you should fix your if statement. Remember that even if the expressions inside the if statements seem to be exclusive, you should make sure they are, just to be safe. I found that having several plain if statements in a row in this manner can cause some odd bugs to appear.
If that wording wasn't vey clear, try this: If z is greater than zero, do something. OTHERWISE, check if z is less than zero and do something. OTHERWISE, do something else. The OTHERWISE is the key.

Hopefully that's your problem. I don't see anything wrong with the code other than that. If it's still not working, try posting some more code and more information about what it's doing.

-Malkiri

Was This Post Helpful? 0
  • +
  • -

#4 kalpeshmjoshi  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 60
  • Joined: 25-April 01

Re: HELP ME SOON!!!PLEASE

Posted 22 May 2001 - 08:59 PM

Hi EnKRYpTeD this is your corrected code.
if(z<0) 
cout<<"blabla
"; 
[color=blue]else if (z>0) [/color]
cout<<"blabla
"; 
else 
cout<<"blabla"; 

Malkiri is has said about your code which I have write in blue. Look at there and think about if Z is -1 then what gose wrong and where in your code ? I have fix this problem but I want to know that you have understand this or not so explain it to me.
[color=blue]

(Edited by kalpeshmjoshi at 4:09 am on May 23, 2001)

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1