Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Page 3 of 3 FirstFirst 123
Results 17 to 20 of 20
  1. #17
    naodx is offline Registered User
    Join Date
    Jan 2003
    Location
    Omaha, Ne
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    might want to change your cout to reflect the change to, something like:

    cout << "Input an equation to solve, eg. ( 1 + 2 )" << endl;

  2. #18
    bkaron's Avatar
    bkaron is offline Yep, That's Me!
    Join Date
    Oct 2003
    Location
    Florida
    Posts
    256
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, cool thanks man
    PowerBook G4
    - 867MHz G4, 640MB, 80GB HD, 80GB EHD, SuperDrive, Airport, Mac OS X 10.4.8

  3. #19
    Richard Baker is offline Registered User
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with your code

    Quote Originally Posted by bkaron View Post
    Oh yea, you need the program don't ya

    #include <iostream>
    using namespace std;

    void addition ()
    {
    char oper;
    float x, y, ans;
    cout << "Enter the problem: ";
    cin >> x;
    cin >> y;
    cin >> oper;
    if(oper == '+')
    ans = x+y;
    cout << ans;
    }

    void sub ()
    {
    char oper;
    float x, y, ans;
    cout << "Enter the problem: ";
    cin >> x;
    cin >> y;
    cin >> oper;
    if(oper == '-')
    ans = x-y;
    cout << ans;
    }

    void mult ()
    {
    char oper;
    float x, y, ans;
    cout << "Enter the problem: ";
    cin >> x;
    cin >> y;
    cin >> oper;
    if(oper == '*')
    ans = x*y;
    cout << ans;
    }

    void divd ()
    {
    char oper;
    float x, y, ans;
    cout << "Enter the problem: ";
    cin >> x;
    cin >> y;
    cin >> oper;
    if(oper == '/')
    ans = x/y;
    cout << ans;
    }

    int main ()
    {addition ();
    sub ();
    mult ();
    divd ();
    }






    _______________________________________________________________

    I had problems when I ran your code. I fixed it by giving your variables a value of 0 when it is being declared. The computer automatically assignes each variable some number so the calculation was wrong. also add this to the end of your code

    system ("pause");
    result 0;

  4. #20
    Arden's Avatar
    Arden is offline Where mah "any" keys at?
    Join Date
    Dec 2002
    Location
    Spokane, WA
    Posts
    7,752
    Thanks
    0
    Thanked 1 Time in 1 Post
    Systems:
    2.5 GHz MacBook Pro Core 2 Duo, 4 GB RAM, 320 GB hard drive, runs 10.6.8
    1.6 GHz iMac G5, 1.5 GB RAM, 120 GB hard drive, runs 10.4.11 (out of commission)
    iPhone 4, 16 GB, iOS 4.3.5

 

 
Page 3 of 3 FirstFirst 123

Similar Threads

  1. MAC OS X 'Mail' program
    By droliff in forum Mac OS X System & Mac Software
    Replies: 8
    Last Post: March 22nd, 2003, 07:33 AM
  2. Power Mac G4 Power Supply Exchange Program
    By bobw in forum Hardware & Peripherals
    Replies: 3
    Last Post: February 22nd, 2003, 02:17 AM
  3. How to compile stuff
    By fintler in forum Unix & X11
    Replies: 1
    Last Post: August 28th, 2002, 07:57 AM
  4. Anybody ever program a Classic app?
    By konan in forum Mac Classic System & Software
    Replies: 0
    Last Post: July 12th, 2002, 11:41 AM
  5. iTunes: the program formerly known as cool
    By Gregita in forum Opinions, & Open Letters
    Replies: 15
    Last Post: June 24th, 2002, 11:32 AM

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
  •