#include <iostream>
#include <windows.h>
using namespace std;
float v1;
float v2;
int oper;
float ans;
int add()
{
v1 + v2 == ans;
}
int sub()
{
v1 - v2 == ans;
}
int mult()
{
v1 * v2 == ans;
}
int div()
{
v1 / v2 == ans;
}
int main()
{
cout<< "Value 1 >>";
cin>> v1;
cout<< "Value 2 >>";
cin>> v2;
cout<< "Operator >>";
cin>> oper;
if (oper == '+')
{
add();
cout<<ans;
return(0);
}
}
Is this a proper way to do a simple calculator like this? It works up to the if statment. It just closes and doesnt call the add int to assess the ans. Im new to programming and am curious what im doing wrong and if im even going about this the right way. Thanks