1) Open program to write code
2) Write code
3) Compile code
4) If you have compiler errors fix them and go to step 3 else continue
5) Run code and make sure you get what you want else go to step 2

how can i make a calculator using function and procedure..

With all due respect, this is far too broad a question for us to try to answer, even if we were inclined to do the work for you in the first place - which we are not. NathanOliver's answer is about the most any of us can give without a lot more details about what you need to do, and a lot more evidence that you have tried to solve the problem yourself.

Whatr specifically do you need help with? If you are having trouble understanding how functions work, there are plenty of older posts on the subject here; a search should turn up dozens.

Edited 1 Year Ago by Schol-R-LEA

Note: There are many way to design a solution ...

Here is just one simple way ...

and a shell program that should get you started:

// cal_shell.cpp //


#include <iostream>

using namespace std;

// your functions go here ...??

double add( double a, double b )
{
    return a + b;
}

 double sub( double a, double b )
{
    return a - b;
}

// ... the rest of your functions go here //



int main() 
{
    // print out an intro...

    // prompt and take in the op requested ...add, sub, etc...
    cout << "Which op ... Enter + or - or ... ";
    char op = 0;
    cin >> op;

    double a = 0.0, b = 0.0, c = 0.0; // get some doubles

    // now prompt and take into 'a' annd 'b' valid doubles

    switch( op )
    {
        case '+' : c = add( a, b ); break;
        case '-' : c = sub( a, b ); break;

        // ... rest goes here ...//



        default:
            cout << op << " is NOT implemented here yet ...\n";
    }

    cout << "for the binary op " << op << " on " << a << " and " << b
         << ", the result returned was " << c << endl;
    cout << "All done ... press 'Enter' to cobtinue/exit ... " << flush;
    cin.get();
}

Edited 1 Year Ago by David W

@basit do encourage menex's behavior. If they have a question they should ask there own question. Also you shouldn't answer question just asking for code.

This article has been dead for over six months. Start a new discussion instead.