I am trying to make a calculator in C++ but I keep running into errors. Please help me.
Here is the code:
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main()
{ //what the variables are
double calculation;
double sign;
double number1;
double number2;
//the questions
cout<<"Enter a Number"<< endl;
cin>> number1;
cout<<"Enter Another Number"<< endl;
cin>> number2;
cout<<"Enter what you would like to do with these numbers"<< endl;
cout<<"For example * to multiply, / to divide, - to subtract, and + to add"<< endl;
cin>> sign;
//the calculations and answer
if {sign=*}
calculation=number1*number2;
cout<<number1<<"*"<<number2"="<<calculation<<endl;
if {sign=/}
calculation=number1/number2;
cout<<number1<<"/"<<number2"="<<calculation<<endl;
if {sign=-}
calculation=number1-number2;
cout<<number1<<"-"<<number2"="<<calculation<<endl;
else {sign=+}
calculation=number1+number2;
cout<<number1<<"+"<<number2"="<<calculation<<endl;
return 0;
}