Thread: Calculator program problemo

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    100

    Calculator program problemo

    Code:
    #include <cstdio>
    #include <cstdlib>
    #include <string>
    #include <cmath>
    #include <iostream>
    using namespace std;
    
    float Squareroot(float x);
    float Add(float x, float y);
    float Subtract(float x, float y);
    float Multiply(float x, float y);
    float Divide(float x, float y);
    
    int main() {
        
        cout << "Math Program v.1.8" << endl;
        
        float numberA;
        float numberB;
        cout << "What two numbers would you like to input?" << endl;
        cin >> numberA;
        cin >> numberB;
       
        cout << "Would you like to: \n" ;
        cout << "Square[r]oot?" << endl;
        cout << "[a]dd" << endl;
        cout << "[s]ubtract" << endl;
        cout << "[m]ultiply" << endl;
        cout << "or [d]ivide the numbers?" << endl;
        
        float funcvarbname; 
        
        string Option;
        if (Option == "r") {funcvarbname=Squareroot(numberA);}; 
        if (Option == "a") {funcvarbname=Add(numberA, numberB);};
        if (Option == "s") {funcvarbname=Subtract(numberA, numberB);};
        if (Option == "m") {funcvarbname=Multiply(numberA, numberB);};
        if (Option == "d") {funcvarbname=Divide(numberA, numberB);};
        
        cout << funcvarbname << endl;
        
        system("PAUSE");
        return 0;
    }
    Well I fixed my original error, but now it doesn't print the answers to my functions! Help please!
    Last edited by blankstare77; 09-04-2005 at 10:05 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows Picture and Fax Viewer Problemo
    By The Brain in forum Tech Board
    Replies: 0
    Last Post: 02-08-2006, 05:41 PM
  2. A little GDI/Msg type problemo
    By Mithoric in forum Windows Programming
    Replies: 3
    Last Post: 02-21-2004, 08:52 PM
  3. system problemo
    By Stan100 in forum Game Programming
    Replies: 5
    Last Post: 11-15-2002, 03:22 PM
  4. Character Creation Problemo
    By drdroid in forum C++ Programming
    Replies: 9
    Last Post: 09-15-2002, 10:04 AM