Notices
Results 1 to 2 of 2

Thread: Help!

  1. #1 Help! 
    New Member
    Join Date
    Jun 2009
    Posts
    1
    Could anyone recommend a free Quadratic Problems (QP) solve which offers C API that I can use it in my C++ programs?
    Thank you!
    [/img]


    Reply With Quote  
     

  2.  

    Related Discussions:

     

  3. #2  
    Forum Sophomore
    Join Date
    Mar 2009
    Posts
    139
    Seems like you're a beginner in programming. For ease of use, use iostream and CMath.

    float out=out1=out2=A=B=C=rt=0;
    int im=0;

    cout << "Enter A, B, C" << endl;
    cin >> A >> B >> C;

    if (4*A*C > B*B) {
    im=1;
    }

    rt = sqrt(abs( (B*B) - (4*A*C)));
    rt = rt/(2*A);

    out = (-1*B);
    out = out / (2*A);


    if (im == 0 ) {
    out1 = out - rt;
    out2 = out + rt;

    cout << "Your solutions are: " << out1 << " and " << out2 << endl;

    } else {

    cout << "Your solutions are: " << endl ;
    cout << out << " + " << rt << "i" << endl;
    cout << out << " - " << rt << "i" << endl;

    }


    I did not test this, but it should work, barring typos.


    --
    -M

    "Those that would give up essential liberty to obtain a little temporary
    safety deserve neither liberty nor safety."

    -Benjamin Franklin, An Historical Review of Pennsilvanya, 1759
    Reply With Quote  
     

Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •