error cannot convert parameter 1 from int[15] to char [][20]

I made a code to get total prices for seats in theater.
but i got a error message "Error 1 error C2664: 'priceFile' : cannot convert parameter 1 from 'int [15]' to 'char [][20]'"

here is 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <fstream>

using namespace std;

void priceFile(char seat[15][20]);

int main()
{

	const int ROW = 15;
	const int SEATS = 20;

	char avail = '*';
	char taken = '#';
	int choice,choiceRow,choiceSeat;

	char seats[ROW][SEATS];

	cout << "* Seats Available\n# Reserved Seats" << endl;
	cout << "Seats:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19";
	for(int i = 0; i < ROW; i++)
	{
		cout << "\nROW" << setw(3) << i;
		for(int index = 0; index < SEATS; index++)
		{
			seats[i][index] = avail;
			cout << setw(3) << seats[i][index];
		}
	}
	cout << "\n\nMENU:\n1) Buy ticket\n2) Total sell and exit" << endl;
	cout << "Enter your choice :";
	cin >> choice;
	
	while(choice == 1)
	{
		cout << "Enter row: ";
		cin >> choiceRow;
		cout << "Enter seat: ";
		cin >> choiceSeat;

		if(seats[choiceRow][choiceSeat] = avail)
		{
			seats[choiceRow][choiceSeat] = taken;
		}

		cout << "* Seats Available\n# Reserved Seats" << endl;
		cout << "Seats:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19";
		for(int i = 0; i < ROW; i++)
		{
			cout << "\nROW" << setw(3) << i;
			for(int index = 0; index < SEATS; index++)
			{
				cout << setw(3) << seats[i][index];
			}
		}
		cout << "\n\nMENU:\n1) Buy ticket\n2) Total sell and exit" << endl;
		cout << "Enter your choice :";
		cin >> choice;
	}
	if(choice ==2)
	{
		cout << "UPDATED SEATING CHART AND SALES INFO";
		cout << "* Seats Available\n# Reserved Seats" << endl;
		cout << "Seats:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19";
		for(int i = 0; i < ROW; i++)
		{
			cout << "\nROW" << setw(3) << i;
			for(int index = 0; index < SEATS; index++)
			{
				cout << setw(3) << seats[i][index];
			}
		}
		int sold = 0;
		for(int i = 0; i < ROW; i++)
		{
			for(int index = 0; index < SEATS; index++)
			{
				if(seats[i][index] == taken)
				{
					sold++;
				}
			}
		}
		cout << "\nTOTAL TICKET SOLD : " << sold;

		int total = 0;
		int prices[15];

		priceFile(prices);
		
		for(int i = 0; i < 15; i++)
		{
			for(int index = 0; index < 20; index++)
			{
				if(seats[i][index] == taken)
				{
					total += prices[i];
				}
			}
		}
		cout << "\nTOTAL REVENUE : $ " << total;


	
	}
}

void priceFile(int prices[15])
{
	string fname = "prices.dat";
	ofstream inFile;
	inFile.open(fname.c_str());
	for(int i = 0; i < 15; i++)
	{
		if(i < 4)
		{
			prices[i] = 5;
			inFile << prices[i];	
		}
		else if(i < 10)
		{
			prices[i] = 10;
			inFile << prices[i];	
		}
		else if(i < 15)
		{
			prices[i] = 5;
			inFile << prices[i];	
		}	
	}
	return;
}
prices is of type int[15] and you try to pass it to a function taking a char [][20]
Look at this:
1
2
void priceFile(char seat[15][20]);
void priceFile(int prices[15])


Your declaration has to match the definition.
Topic archived. No new replies allowed.