Math issue

I just started c++ Today. I have been working on a simple calculator. When i leave out all if statements but 1, it works fine. When I put in other if statements i get really weird numbers like 3*3=6
heres my code.
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
27
28
29
30
#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    cout <<"CALC V.1 ||| Press enter to continue";
    cin.ignore();
    cout <<"1=+ 2=- 3=* 4=/ ";
    cout <<"Please enter an arithmetic operator: ";
    cin>>a;
    cout <<"Please enter a number: ";
    cin>>b;
    cout <<"Please enter a number :";
    cin>>c;
    cout <<"press enter to continue""\n";
    cin.ignore();

   if (a==1);
   {cout << b+c;};
   if (a==2);
   {cout << b-c;};
   if (a==3);
   {cout << b*c;};
   if (a==4);
   {cout << b/c;};

   return 0;
}

When i take out the other 3 if statements, it works fine. But when I add the rest in i get the weird numbers. Can someone help?
it is not require ';' after if()
You have too many ;. If statements aren't supposed to have one after them, and { } sections don't need them. Also, I would suggest indenting your code there:

1
2
3
4
if(a == 1) {
    cout<< b+c;
}
//... 
thank you. Than helped alot
Topic archived. No new replies allowed.