#include <iostream>
using namespace std;
int main() {
int a;
int b;
int input;
int result;
cout << "Enter in a number\n";
cin >> a;
cout << "Now enter a second in\n";
cin >> b;
cout << "Now choose which operation you'd like\n";
cout << "1. Addition\n";
cout << "2. Multiplication\n";
cout << "3. Subtraction\n";
cout << "4. Divison\n";
cin >> input;
if (input = 1) {
result = addition (a,b);
}
else if (input = 2) {
result = multiplication (a,b);
}
else if (input = 3) {
result = subtraction (a,b);
}
else if (input = 4) {
result = division (a,b);
}
cout << "The operator specified returned " << result << ".\n";
return 0;
}
int addition(int a, int b) {
return (a+b);
}
int multiplication(int a, int b) {
return (a*b);
}
int division(int a, int b) {
return (a/b);
}
int subtraction(int a, int b) {
return (a-b);
}
I get an error when I try to build in netbeans saying that lines 21, 24, 27 ,and 30
(the result = <functionname> ones)
that say: error: 'addition/multi/etc' was not declared in this scope
I've tried several things and checked several programming sites yet none offered help that relate to this problem.
And yes, I know this is really basic. I wanted to make sure I understood functions before I start using classes/structures