Calculatron 2000

#include <iostream>
using namespace std;

int a;
int b;
int operation
int operation1;
int operation2;
int operation3;
int operation4;

int main()
{



cout << "Hello and welcome to the Calculatron 2000. If you have difficulty doing math, then this is the tool for you! Please input your math problem.";
cin >> a >> operation >> b;

if (operation = '+')
(a + b) = operation1;
if (operation = '*')
(a * b) = operation2;
if (operation = '/')
(a / b) = operation3;
if (operation = '=')
(a = b) = operation4;

}
{
return() 0; }


I have no idea what's wrong...then again I am new to C++.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
int a;
int b;
char operation;

int main()
{
  cout << "Hello and welcome to the Calculatron 2000. If you have difficulty doing math, then this is the tool for you! Please input your math problem." << endl;

  cin >> a >> operation >> b;
 
  int res = 0;

  if (operation == '+')
    res = (a + b);
  else if (operation == '*')
    res = (a * b);
  else if (operation == '/')
    res = (a / b);
  else if (operation == '-')
    res = (a - b);
 

  cout << res << endl;

  return 0;
}
Topic archived. No new replies allowed.