View difference between Paste ID: yB18L2SY and 0713yx69
SHOW: | | - or go back to the newest paste.
1-
The else statement is showing up as an error and i did't do anything wrong i dont think. Any help would be great!:
1+
//The else statement is showing up as an error and i did't do anything wrong i dont think. Any help would be great!:
2
3
4
5
6
7
#include <iostream>
8
 
9
 
10
using namespace std;
11
 
12
 
13
 
14
int main()
15
{
16
        int a;
17
        int b;
18
        int c;
19
        int var;
20
 
21
        int sum;
22
        cout << "Would you like Multiplication(1) or addition(0)";
23
        cin >> var;
24
    if(var == 1)
25
       
26
 
27
 
28
        cout << "Enter a number\n";
29
        cin >> a;
30
 
31
        cout << "Enter Another Number\n";
32
        cin >> b;
33
 
34
        cout << "One more!\n";
35
        cin >> c;
36
 
37
 
38
        sum = a * b * c;
39
 
40
        system("pause");
41
        return 0;
42
        else
43
        {      
44
       
45
                cout << "Enter a number\n";
46
                cin >> a;
47
                cout << "Enter Another Number\n";
48
                cin >> b;
49
                cout << "One more!\n";
50
                cin >> c;
51
                sum = a + b + c;
52
                cout << "The sum is " << sum << endl;
53
                system("pause");
54
                return 0;
55
 
56
        }
57
}