Error: expected ; before 'endl'
Nov 27, 2019 at 7:08pm Nov 27, 2019 at 7:08pm UTC
Any idea why I'm getting that on line 25 & line 26?
Unless I am seriously misreading this, I clearly see ;'s where they should be. I must have messed something else up for this error to occur?
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
#include <iostream>
using namespace std;
string fname;
string lname;
string email;
char ps;
char seat;
char selection;
float cost;
int main() {
cost = 0;
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 == 'N' || seat == 'n' ) {
cout << "Your total: " << "$" << cost << endl;
cout << "Airport charges & taxes: " << "$10" << endl;
cout << "Amount to be paid: " << "$" << cost + 10 << endl;
]else if (seat == 'Y' || seat == 'y' ) {
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' ) {
cout << "Your total: " << "$" << cost + 45 << endl;
cout << "Airport charges & taxes: " << "$10" << endl;
cout << "Amount to be paid: " << "$" << cost + 10 << endl;
} else if (selection == 'D' || selection == 'E' || selection == 'F' || selection == 'd' || selection == 'e' || selection == 'f' || selection == 'G' || selection == 'g' || selection == 'H' || selection == 'h' )
cout << "Your total: " << "$" << cost + 25 << endl;
cout << "Airport charges & taxes: " << "$10" << endl;
cout << "Amount to be paid: " << "$" << cost + 10 << endl;
}
}
Nov 27, 2019 at 7:28pm Nov 27, 2019 at 7:28pm UTC
Try
1 2 3
cout << "Please enter your email address:" << endl;
cin >> email;
Nov 27, 2019 at 7:30pm Nov 27, 2019 at 7:30pm UTC
<<
Nov 27, 2019 at 11:02pm Nov 27, 2019 at 11:02pm UTC
Gosh darn it, okay I added the cin >> email.
Still an idiot making silly mistakes despite coding for several months now.... :(
Topic archived. No new replies allowed.