#include <iostream>
usingnamespace std;
float a;
float b;
char c;
float d;
int main() {
cout<<" Calculator \n Enter your equation with each action being followed by enter\n";
cin>> a;
cin>> c;
cin>> b;
switch (c) {
case'+':
d == a + b;
cout<<"=\n" <<d<< endl;
break;
case'-':
d == a - b;
cout<<"=\n" <<d<< endl;
break;
case'*':
d == a * b;
cout<<"=\n" <<d<< endl;
break;
case'/':
d == a / b;
cout<<"=\n"<< "" << d << endl;
break;
default:
cout<<"Invalid\n Try Again";
}
}
The output works great except no matter what numbers / operations I input it always comes out with 0 I know that it is reaching the cout that displays the output because the = is displayed but it always says 0. Any help would be appreciated.
Thanks!