Thread: Help with Complex Quadratic Problem

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    2

    Help with Complex Quadratic Problem

    I've been trying to get this to compile, but it isn't cooperating. Does anyone know what the problem is?

    else (discriminant < 0 ) {

    square_root = sqrtf(-discriminant);
    x1 = -b / (2 *a);
    x1_i = square_root / (2 * a);
    x2 = x1;
    x2_i = x1_i;
    printf("There are two complex roots.\n");
    printf("x1 = %f = %f i and x2 = %f - %f i\n", x1, x2, x1_i, x2_i);

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    else if, instead of else.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    2
    Gah. Thanks so much man. Well now I feel like a spoony bard...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with complex numbers
    By dsc in forum C Programming
    Replies: 2
    Last Post: 12-12-2006, 01:18 PM
  2. quadratic probing (collision resolution) problem
    By rakan in forum C++ Programming
    Replies: 2
    Last Post: 11-26-2006, 12:30 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  4. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM