I'm new to C++. I tried to compile this on a Mac in Terminal using gcc, but I got the symbols not found, along with a linker error. What seems to be the problem here? Thanks in advance!
# include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
char o;
float num1, num2;
cout << "Enter operator either + or - or * or /";
cin >> o;
cout << "Enter two operands: ";
cin >> num1 >> num2;
switch(o) {
case '+':
cout << num1+num2;
break;
case '-':
cout << num2-num1;
break;
case '*':
cout << num1*num2;
break;
case '/':
cout << num1*num2;
break;
default:
cout << "Error, operator is not correct";
break;
}
return 0;
}