expected deceleration before '}' token

Okay... I'm getting "expected deceleration before '}' token on line 98"
If I remove a couple brackets, the code runs but incorrectly. It will loop at the seat selection.

How can I have the program print the total cost and quit without going to seat selection? (If user selects n/N)

I can't get the user to have their total price come up if they type y/Y, they will get the total twice. :(

I moved code around A LOT. But I was trying to get a boolean quit to only show the seating if the value is true, which is not working. What's my issue?

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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
  #include <iostream>

using namespace std;

string fname;
string lname;
string email;
char ps;
char seat;
char selection;
float cost;
float tax;
float total;
bool quit = false;


int main() {

    cost = 0;
    tax = 0.10;

    cout << "Welcome to the CheapCheapHurray on-line reservation system." << endl;
    cout << "===========================================================" << endl;

    cout << "Please enter your first name: " << endl;
    cin >> fname;
    cout << "Please enter your last name:" << endl;
    cin >> lname;
    cout << "Please enter your email address:" << endl;
    cin >> email;

    cout << "===========================================" << endl;
    cout << "Select your winter sale package:" << endl;
    cout << "(Promo is limited to one ticket per person)" << endl;
    cout << "(A) GNV-JFK-GNV              ($25 per seat)" << endl;
    cout << "(B) MCO-LAX-MCO              ($55 per seat)" << endl;
    cout << "(C) GNV-LAS-GNV              ($50 per seat)" << endl;
    cin >> ps;
    cout << "Great choice " << fname << " " << lname << "!" << endl;

    if (ps == 'A' || ps == 'a') {
            cost = cost + 25;
    } else if (ps == 'B' || ps == 'b') {
        cost = cost + 55;
    } else if (ps == 'C' || ps == 'c') {
        cost = cost + 50;
    }

    cout << "Press (Y) to select your seat or (N) proceed to payment:" << endl;
    cin >> seat;

    if (seat == 'Y' || seat == 'y') {
    quit = false;

    }else if (seat == 'N' || seat == 'n') {
        cout << "Your total:               " << "$" << cost << endl;
        cout << "Airport charges & taxes:  " << "$" << cost * tax << endl;
        total = cost * tax;
        cout << "Amount to be paid:        " << "$" << cost + total << endl;
        quit = true;
    }

    while (!quit) {

    cout << " " << endl;
    cout << "      o o o o o o o o" << endl;
    cout << "     o               o" << endl;
    cout << "    -------------------" << endl;
    cout << "   o[A] [X]     [X] [X]o" << endl;
    cout << "  o [X] [X]     [B] [C] o" << endl;
    cout << "  -----------------------" << endl;
    cout << "o [X] [X] [X]  [X] [X] [X] o" << endl;
    cout << "o [X] [X] [X]  [D] [E] [X] o" << endl;
    cout << "o [X] [F] [X]  [X] [X] [X] o" << endl;
    cout << "o [X] [X] [G]  [X] [H] [X] o" << endl;
    cout << "o [X] [X] [X]  [X] [X] [X] o" << endl;
    cout << "----------------------------" << endl;
    cin >> selection;
    cout << "Seat selection: " << selection << endl;

    if (selection == 'A' || selection == 'B' || selection == 'C' || selection == 'a' || selection == 'b' || selection == 'c') {
        cost = cost + 45;

    } else if (selection == 'D' || selection == 'E' || selection == 'F' || selection == 'd' || selection == 'e' || selection == 'f' || selection == 'G' || selection == 'g' || selection == 'H' || selection == 'h')
        cost = cost + 25;
        }

        cout << "===========================================" << endl;
        cout << "Your total:               " << "$" << cost << endl;
        cout << "Airport charges & taxes:  " << "$" << cost * tax << endl;
        total = cost * tax;
        cout << "Amount to be paid:        " << "$" << cost + total << endl;
        cout << "===========================================" << endl;
        cout << "Your booking confirmation has been sent to " << email << endl;
        cout << "Thanks for your reservation, " << fname << " " << lname << ". Enjoy your trip!!!" << endl;
        quit = true;
}
}

}



Thanks again. I really appreciate all the help I have gotten from this forum!
Last edited on
Consistent indentation would probably help you see the problem easier.


Check your brace placement and that each brace has the corresponding brace.

You're probably right.

My visual studio 2019 (trial expired) won't open anymore and I can install the 2017 version I have a code for because it doesn't exist... So I've been using codeblocks and it's been frustrating to say the least.

I'll go back and fix my formatting and see if I find anything that sticks out, thanks!
Unlike the commercial editions of Visual Studio, the Community Edition does not have a trial period:
https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16

The word in the error message is declaration, meaning announcement, not deceleration, meaning reduction in speed.
Last edited on
Topic archived. No new replies allowed.