int plus(int y,int x)
{
return x+y;
}
int minus(int y,int x)
{
return x-y;
}
int divide(int y,int x)
{
if(x=0)
{
cout<<"error"; //cannot divide by 0
}
else
{
return x/y;
}
}
int times(int y,int x)
{
return x*y;
}
int main()
{
int val1,val2;
cout<<Enter integers; //I dont know how i will correct this main
cin>>val1>>val2;
cout<<plus<<times<<divide<<times;
}
You have probably just first-hand encountered the problems of having using namespace std in your code. std::plus already exists as a function taking two arguments, while you have provided another possibility for the call, hence the ambiguity of the call. If you instead remove that line and fully qualify your statements, you won't run across that problem later. Try something like this: