### I'm very confused with this program.

I think its not working cause I'm not calling the functions right, but I've changed the function calls in every way I could think of and they aren't working. If I change it to anything but what I have I get build errors. This program is a practice problem I'm working on (Make your calculator program perform computations in a separate function for each type of computation.) When the user inputs the type of operation they want to use it doesn't jump to the function that is assigned to the selected operation. If I'm not calling the functions right, can someone rewrite one of the function calls the right way so I can see? Thanks in advance for any help.

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263`` ``````#include #include using namespace std; //------Function prototypes---------| void add ( int numb1, int numb2); void subtract (int numb1, int numb2); void multiply (int numb1, int numb); void divide (int numb1, int numb2); int main() { int numb1; int numb2; string operation; cout << "Enter the first number and then the second number" << "\n"; cin >> numb1; cin >> numb2; cout << "Select the type of operation you want to do: add, subtract, multiply, or divide" << "\n"; cin >> operation; if(operation == "add") { void add (int numb1, int numb2); } else if(operation == "subtract") { void subtract (int numb1, int numb2); } else if (operation == "multiply") { void multiply (int numb1, int numb2); } else if (operation == "divide") { void divide (int numb1, int numb2); } return 0; } //------------------------Arithmetic functions----------------------| void add (int numb1, int numb2) { cout << numb1 << "+" << numb2 << "=" << numb1 + numb2; } void subtract (int numb1, int numb2) { cout << numb1 << "-" << numb2 << "=" << numb1 - numb2; } void multiply (int numb1, int numb2) { cout << numb1 << "*" << numb2 << "=" << numb1 * numb2; } void divide (int numb1, int numb2) { cout << numb1 << "/" << numb2 << "=" << numb1 / numb2; }``````
This is not a function call, it's a function declaration:
`void add (int numb1, int numb2);`

THIS is how a function call looks like:
`add(numb1, numb2);`
Thank you very much Athar :D
Topic archived. No new replies allowed.