reading from file giving me weird numbers

Hello everybody. i am trying to create a function called void theaterPrices(int prices[]) that reads in 15 numbers from a txt file and stores them in the array prices. the function then displays the prices. when i display the prices, it displays them all as -858993460. i have tried everything but can't seem to get it to display the numbers correctly. I even deleted the file name and it is still displaying this weird number. I am not sure what do to so if any body can help i would appreciate it. below 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
137
138
139
140
141
142
143
144
145
//Author:	Steven Cortright
//Course:	CSC 136
//Date:		Spring 2013
//Purpose:	Develop a program that will allow a theater to sell tickets for performances

#include <cstdlib>
#include <string>
#include <iostream>
#include "search.h"
#include <fstream>
using namespace std;

const int numSeats = 30;
const int numRows = 15;
const char seatTaken = '*';
const char seatEmpty = '#';
char seats[15][30];

/////////////////////////////////////function Prototypes//////////////////////////////////////////////


int menu();													//function to display menu
void theaterPrices(int prices[]);
void showSeating (char seats[numRows][numSeats]);	        //function to display seating chart
void customerProcessing(char seats[15][30], int rSelect, int sSelect);						//function to ask user what seat they want
//void checkAvailability(char seats[15][30]);



int main()
{
	
	char seating [15][30];
	int cost[15];
	int selectedRow = -1;
	int selectedSeat = -1;
	int help = 0;
	int choice = 0;


	choice = menu();
	switch (choice)
	{
	case 1:
			customerProcessing(seats, selectedRow, selectedSeat);;
			break;
	case 2: 
			showSeating(seating);
			theaterPrices(cost);
			break;
	case 3:
			cout << "You picked number 3.";
			break;
	case 4:
			cout << "quit\n";
			break;
	default: cout << "Error input\n";

	}
	return 0;
}
int menu() //displays menu   WORKS
{
	int pick;
	cout << endl;
	cout << "1.  Process a Customer" << endl;
	cout << "2.  Print a seating chart" << endl;
	cout << "3.  Report total tickets sold and total price" << endl;
	cout << "4.  Quit" << endl;
	cout << "Choice:  ";
	cin >> pick;
	cout << endl;
	return pick;
}



void showSeating (char seats[numRows][numSeats])  //displays current seating chart  WORKS
{
	cout << "                   Seats" << endl;
	cout << "       123456789012345678901234567890" << endl;
	
	char input = '#';
	for(int row = 0; row < 15; row ++)
	{
		for (int col = 0; col < 30; col ++)
		{
			seats[row][col] = input;
		}
	}
	
	for(int row = 0; row < 15; row ++)
	{
		cout << "Row " << (row + 1) << "  ";
		for (int col = 0; col < 30; col ++)
		{
			cout << seats[row][col];
		}
		cout << endl;
	}
}

void customerProcessing(char seats[15][30], int rSelect, int sSelect)
{
	int seatSelection;
	int rowSelection;
	cout << "Enter the row and set you want: ";
	cin >> rowSelection >>  seatSelection;
	rSelect = rowSelection;
	sSelect = seatSelection;
	cout << seats[rowSelection][seatSelection];
}



/*void checkAvailability(char search[15][30])
{
	
	if (seating [rowSelection][seatSelection] == '#')
	{
		
	
}
*/




void theaterPrices(int prices[]) //reads in seat prices
{
	ifstream infile("C:\Users\Owner\Documents\Visual Studio 2008\Projects\Theater");
		for(int i=0; i < 15; i++)
		{
		infile >> prices[i];
		}
	
	infile.close();
	for (int j = 0; j<15; j++)
	{
		cout << prices[j];
	}
}


Topic archived. No new replies allowed.