Help with algebra code

This is a discussion on Help with algebra code within the C++ Programming forums, part of the General Programming Boards category; and it happens to be..................*cough*....................*ah em*..............................*ack*............ ....

  1. #16
    Registered User
    Join Date
    Apr 2007
    Posts
    13
    and it happens to be..................*cough*....................*ah em*..............................*ack*............ .

  2. #17

  3. #18
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444
    Wow, instead of just typing it into google and getting the result immediately, you are persistent and ask as long as you don't get an answer ... try sqrt().

  4. #19
    Registered User
    Join Date
    Apr 2007
    Posts
    13
    ok thanks i get the point, ill research stuff first next time

  5. #20
    Registered User
    Join Date
    Apr 2007
    Posts
    13
    thanks for the help, and i thought id post another project i finished, this one solves quadratics
    Code:
    #include <cstdlib>
    #include <iostream>
    #include <math.h>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        int e;
        e = 1;
        while (e == 1)
        {
        float a;
        float b;
        float c;
        float x;
        float w;
        float q;
        cout << "A = _";
        cin >> a;
        cout << "B = _";
        cin >> b;
        cout << "C = _";
        cin >> c;
        system("echo Positve Answer");
        w = (-b + sqrt (pow (b,2) - 4 * a * c));
        q = (w / (2*a));
        cout << q; 
        system("echo .");   
        system("PAUSE");
        system("echo Negative Answer");
        w = (-b + sqrt (pow (b,2) - 4 * a * c)*-1);
        q = (w / (2*a));
        cout << q;
        system("echo .");
        system("pause");
        cout << "Enter 1 to solve another one!";
        cin >> e;
    }
        return EXIT_SUCCESS;
    }
    my only problem with it is that i cant keep numbers as fractions, oh well!

  6. #21
    Registered User
    Join Date
    Dec 2004
    Posts
    465
    Now try to code it so that it deals with imaginary numbers and also can give you an exact solution instead of the approximate. I did the same thing with my graphing calculator, but the teacher gives out a similar program with less functionality than mine. Either way I'm sure no one would pay for it and it pains me to see that you want to sell it especially when it's such a tiny program.
    My computer is awesome.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 08:34 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 11:20 AM
  3. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 05:39 PM
  4. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21