But, every time i try to get an answer, it's always wrong.
A sample output compared to expected output would be helpful.
1 2 3 4 5 6 7 8
ac = addition (aa,ab);
cout << "You have chosen addition. Please provide a numerical value: ";
cout << endl;
cin >> aa;
cout << "Please provide another numerical value: ";
cout << endl;
cin >> ab;
cout << "Your result value is " << ac << "." << endl;
This is backwards, you call the function before you set values to aa and ab. Same thing for the rest of them, you always call the function before you assign values.
One thing that tripped me up a little bit was the variables, why do you have so many? a == add could be replaced with a comparison to a specific character (if (/*char*/a == 'a') { //code and such} ).
Can anyone debug this and repost?
It can be done, it's better if you apply the suggested fixes yousel...
Telling me what i did wrong would be good, too.
I laughed so hard. Were you expecting someone to fix it and give it to you?
For starters You are calling all of your operation functions before you get their needed inputs. So the outputs you are getting will be whatever aa and ab are initialized to, which since you didn't specify it will be some random number...
also I might recommend using an enum type for your operation selection and simply a 1-4 selection menu.
That part would look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13
int choice=1;
enum Operation { ADD=1,SUB,MLP,DIV};
cout <<" Select Operation:\n"
<<"1. Add\n"
<<"2.Subtract\n"
// you can complete it from here
cin >> choice;
switch(choice){
case ADD: // you addition set called here break;
case SUB: // you subtraction set called here break;
// etc.
default: cout <<"Error has occured in selection"; break;
make sure to keep a break at the end of each case and to receive your variables before you call the function. But that should get you to the solution.