Hey guys, been trying to make myself a calculator and ran into some trouble lol,
if you guys can spot the problem i'd be thankful :)
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
//fen: first entered number. sen:second entered number. ma:mathematical action
double fen, sen, ma;
double a, b, c, d;
//a - sum outcome. b - difference outcome c - multipication outcome d - division outcome
a = fen + sen;
b = fen - sen;
c = fen*sen;
d = fen / sen;
cout << "Welcome to the world finest calculator\n";
cout << "Please enter the mathematical calculation you want to perform, using + for sum, - for difference, * for multipication and / for division\n";
cin >> fen >> ma >> sen;
if (ma = +)
cout << "The sum of the numbers is:" << a << endl;
if (ma = -)
cout << "The difference of the two numbers is:" << b << endl;
if (ma = *)
cout << "The multipication of the two numbers is:" << c << endl;
if (ma = / )
cout << "The division of the two numbers is:" << d << endl;
cout << "Thank you for using the world best calculator" << endl;
Yeah, there are plenty of problems. This is obvious :
1 2 3 4 5 6 7 8
if (ma = +)
cout << "The sum of the numbers is:" << a << endl;
if (ma = -)
cout << "The difference of the two numbers is:" << b << endl;
if (ma = *)
cout << "The multipication of the two numbers is:" << c << endl;
if (ma = / )
cout << "The division of the two numbers is:" << d << endl;
if (ma = '+')
cout << "The sum of the numbers is:" << a << endl;
if (ma = '-')
cout << "The difference of the two numbers is:" << b << endl;
if (ma = '*')
cout << "The multipication of the two numbers is:" << c << endl;
if (ma = '/' )
cout << "The division of the two numbers is:" << d << endl;
and it still wont work, says it cant identify "fen" and "sen".