C++ functions error

Hey guys, ive written this program for an assignment of mine, its a airline reservation system that allows a user to book seats within two classes, first and second. First class is seats 1-5, second class 6-10. Ive written a program that uses functions and im sure that ive missed something out because im getting this error:

(18) : error C2664: 'FirstClass' : cannot convert parameter 1 from 'bool [5]' to 'int []'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

(20) : error C2664: 'SecondClass' : cannot convert parameter 1 from 'bool [5]' to 'int []'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

heres my code :

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
#include<iostream>
using namespace std;
#define MAX_FIRSTposition 5
#define MAX_SECONDposition 10
int position, ans;
bool firstclass [5]= {0};
bool secondclass [5]= {0};

void FirstClass( int firstclass[]);
void SecondClass( int firstclass[]);
void MainMenuDisplay();
int main()
{
	MainMenuDisplay();
		cout<<"\tWhich class would you like?" << endl;
		cin>>ans;
		if (ans == 1)
			FirstClass( firstclass);
		if (ans == 2)
			SecondClass( secondclass);
		return 0;
}

void MainMenuDisplay()
{
	cout <<"\t--Hello, welcome to AIRLINE RESERVATION--" << endl;
	cout <<"--Please select the following:" << endl;
	cout <<"--[1] For a First-class seat" << endl;
	cout <<"--[2] For a Second-class seat" << endl;
	cout <<"--[3] Quit program.\n\n" << endl;

}
FirstCLass:
void FirstClass( int firstclass[])
{
			char check ; 
			int count = 0 ;
			cout << "\t--Welcome to first class--" << endl;
			do
			{
			cout<<"\tPlease choose a seat"<< endl;
			cin >> position;
				if (position  >= MAX_FIRSTposition)
				{
					cout << "The seating arrangements for this class is 1-5, please pick again." << endl;					 
				}
			}
			while ( position   >= MAX_FIRSTposition);
			if (firstclass [position - 1] == 0) 
			{
				firstclass [position - 1] = 1;
				cout << "Your seat number is: " << position << endl;
			}
			else
			{
				cout << "This seat is already booked" << endl;
			}
			while(count < MAX_FIRSTposition ) 
			{
				if( firstclass[count] == 0)
					break;
				count++;
			};
			if( count >= MAX_FIRSTposition )
			cout<< "\tUnfortunately, the First class is now full." << endl;
}

void SecondClass( int firstclass[])
{
			char check ; 
			int count = 5 ;
			cout << "\t--Welcome to Second class--" << endl;
			do
			{
			cout<<"\tPlease choose a seat"<< endl;
			cin >> position;
				if ( (position  < MAX_FIRSTposition) && (position  >= MAX_SECONDposition) )
				{
					cout << "The seating arrangements for this class is 6-10, please pick again." << endl;					 
				}
			}
			while ( (position  < MAX_FIRSTposition) && (position  >= MAX_SECONDposition));
			
if (firstclass [position - 1] == 0) 
			{
				firstclass [position - 1] = 1;
				cout << "Your seat number is: " << position << endl;
			}
			else
			{
				cout << "This seat is already booked" << endl;
			}
			while( (count > MAX_FIRSTposition ) && (count > MAX_SECONDposition)  ) 
			{
				if( firstclass[count] == 0)
					break;
				count++;
			};
			if( count >= MAX_SECONDposition )
			cout<< "\tUnfortunately, the First class is now full." << endl;
}
Well, both functions take arrays of integers and you pass them arrays of booleans. C++ would convert them for you if you only had a single bool and int, but it can't do that with arrays. Just change the type of either of them.
Topic archived. No new replies allowed.