Hi, i've only been learning c++ for a couple days now, so im fairly new to it. :p. After I read the basic tutorials and got somewhat used to the c++ environment, I attempted to create a calculator and after trying to solve all of my errors, it became very tedious. I solved alot of the errors myself, which were minor mistakes, but I had no idea what was wrong when I got the error: LIBCD.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
Debug/Calculator.exe : fatal error LNK1120: 1 unresolved externals. Any help would be highly appriciated! :D.
#include <iostream>
using namespace std;
int main()
{
int x, y, z;
char op;
int cal(int x, int y, int& z, char op);
cout << "Please enter your first number: ";
cin >> x;
cout << "Please enter your second number: ";
cin >> y;
cout << "Please enter the math operator that you would like to use (Eg. " << x << " ? " << y << ")";
cin >> op;
while ((op = '/') && (y == 0))
{
cout << "Error: Cannot divide by zero." << endl;
cout << "Please enter a legal math operator: ";
cin >> op;
}
cal(x, y, z, op);
cout << x << op << y << " = " << z << endl;
cin.get();
}
int cal(int x, int y, int& z, char op)
{
if (op = '+')
{
z = x + y;
}
else
{
if (op = '-')
z = x - y;
else
{
if (op = '*')
z = x * y;
else
{
if (op = '/')
z = x / y;
}
}
}
return z;
}