Text Based Calculator Help

Hello, Ive been working on this basic text based calculator as a exercise and ive run into a couple errors and cannot figure out what is wrong. Heres the source:
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>

using namespace std;
int Add(int first, int second)
{
    cout << "Recieved " << first << " and " << second << endl;
    return (first + second);
}

int Subtract(int first, int second)
{
    cout << "Recieved " << first << " and " << second << endl;
    return (first - second);
}

int Multiply(int first, int second)
{
    cout << "Recieved " << first << " and " << second << endl;
    return (first * second);
}

int Divide(int first, int second)
{
    cout << "Recieved " << first << " and " << second << endl;
    return (first / second);
}

int main()
{
    cout << ":::: Calculator V. 1\n\n";
    int choice, fNumber, sNumber, Answer;
    
    cout << "1. Add\n";
    cout << "2. Subtract\n";
    cout << "3. Multiply\n";
    cout << "4. Divide\n";
    cin >> choice;
    
    if (choice == 1)
       cout << "Enter your first number ";
       cin >> fNumber;
       cout << "Enter your second number ";
       cin >> sNumber;
       Answer = Add(fNumber, sNumber);
       cout << Answer << endl;
    else if (choice == 2)
         cout << "Enter your first number ";
         cin >> fNumber;
         cout << "Enter your second number ";
         cin >> sNumber;
         Answer = Subtract(fNumber, sNumber);
         cout << Answer << endl;
         
       char response;
       cin >> response;
       return 0;
       }


Error : line 46 expected primary-expression before else.


Thanks. And Please im still learning c++ so if you have any suggestions or tips I could get to make this program better feel free to leave them.
Last edited on
You need curly braces { } around the statements following you if statements if they encompass more than one statement. Indentation is just for show.
THanks!
i made one like this a few weeks back if you need some help, or want me to post the code for it so you can reference stuff of of it :)
Topic archived. No new replies allowed.