Calculator using functions
I am trying to make a calculator using functions, I have a subtraction function and a addition function. I cant really get this program to work and I am in need of some help.
#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
int addition(int a, int b);
int subtraktion(int x, int z);
int main()
{
int number1, number2;
string type;
cout << "Insert first value: \n";
cin >> number1;
cout << "Insert type";
cin >> type;
cout << "Insert second value: \n";
cin >> number2;
if (type == +);
{
cout << addition(number1, number2);
}
else if (type == -);
{
cout << subtraktion(number1, number2);
}
else
{
cout << "Wrong type";
}
system("PAUSE");
}
int addition(int a, int b)
{
return a + b;
}
int subtraktion(int x, int z)
{
return x - z;
}