Problem with seating array function

Hello. I am new to this forum, but have viewed many posts in the past regarding code. My scenario is the typical 'flight seat reservation' but I am stuck when it comes to my array... which brought me here.
flight.h class // to store and display array for seating plan

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
// Flight Class - Scotia 2
// Contains information on seating (array), space available and return to menu option.
#include <iostream>
#include "booking.h"

using namespace std;

struct Seat
{
    int Available;
};

// Structure for seat plan (24 spaces available)
    struct Seat seatArray[4][6];

class Flight
{
//Access methods
public:
// Declare variables
int i,j;

    void seatPlan()
    {

        for (int i=0;i<4;i++)
        {
            for (int j=0;j<6;j++);
                {
                if (seatArray[i][j].Available == 0)
                cout << seatArray[i][j] << " \n";
                }
                    else{ cout << "Seating Plan is unavailable" << endl;}
        }
    }

};


The errors I'm getting areL
"31 warning: name lookup of j has changed"
"22 warning: matches this 'Flight::j' under ISO standard rules"
"29 warning: matches this 'j' under old rules"

"32 error: no match for 'operator<<' in 'std::cout << seatArray(i)[((Flight*)this)->Flight::j]' // NB parenthesis were changed on 'i' because it put my code in italics when posting on here!

... Among others, but these are my main concerns for now.

If it's any help, I'll include the rest of my code below:

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
103
104
105
106
107
108
// Main class - Scotia2
// Main cpp file
#include <iostream>
#include "menu.h"
#include "flight.h"

using namespace std;

int main()
{

Menu m;
m.userMenu();

return 0;
}

//Booking class - Scotia Airlines
//This class will reserve a seat for passenger

#include <iostream>
#include <string>

using namespace std;

class Booking{

    public:
    string fName, sName, busName;
    int age, livesAt;
    float discount;

    void addBooking()

    {
    cout << "Booking Menu\n";
    cout << "Please select ticket type \n";
    cout << "1. Business \n";
    cout << "2. Western Isles \n";
    cout << "3. Ordinary \n";
    cin >> livesAt;
    cout << "Please enter your first name \n";
    cin >> fName;
    cout << "Please enter your secont name \n";
    cin >> sName;
    cout << "Please enter your age \n";
    cin >> age;

    // This will be used to calc total cost for each passenger dependant on ticket type
        if(livesAt = 1)
            {
                discount = 0.75;
                cout << "Please enter your business name\n";
                cin >> busName;
            }

            else if (livesAt = 2)
            {
                discount = 0.90;
            }

            else
            {
                discount = 0.0;
            }
    }


};

------------------------------------------------------------

// Menu class - Scotia2
// main menu file inherits from scotia2.cpp
// Includes from main.cpp

#include <iostream>
#include "flight.h"

using namespace std;

class Menu
{
// Access specifier
public:

    Booking b1;
    Flight f1;

int option;

    int userMenu()
        {

            cout << "Scotia2 airlines";
            cout << "\n 1- Check availability";
            cout << "\n 2- Booking";
            cout << "\n 3- Cancel";
            cout << "\n 4- Exit \n \t";

            cin >> option;

            do{
                switch (option)
                {
                    case 1: f1.seating; // Link to flight.h
                    break;

                    case 2: b1.addBooking();
                    break;

                    //case 3: c1.cancel; // Link to cancel.h
                    //break;

                    case 4: return (0);
                    break;
                }
              }while (option == 0);

                return option;

        }
};



I know that my code will be a little sloppy, and I am welcome to constructive criticism. If anyone is able to enlighten me as to what to go about doing next, or point me in the right direction at least I'd be very grateful.


Happy coding!

TeddyX
Topic archived. No new replies allowed.