When i run the program it runs into an error when displaying. mostly in the seatarrArrangment fuction and it displays odd characters other than the ones in the file this is the output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Row 1 @ºΘ@Cw( 0<ⁿ▐ P< ñ( ╥ iyIL
Row 2 : Φ≡ î °S╠╔ ÿ ?îº
Row 3 Θ╪CwWy ╚° î mCwm2╨000 áp
á
Row 4 P ─ A á°Rp9$pºΘxCwW!¿▄┤ ⁿ
Row 5 ! mdß ─ │░ ╖W @t ╪6° °°
Row 6 NΣ¼╠$,4<DLT\DLT|RRñ¼┤╝─
Row 7 ╠╘▄─╠╘▄╠$,4<DLT\dlt|RSñ¼
Row 8 ┤╝─╠╘▄Σ∞⌠ⁿ║¼Σ╚ ( äü
Row 9 é╘ \╘Xîd ⁿ ╘& s
Row 10 $╨OXÇεX xk xφh╨ñ └ê╨ 8rΓ0╚
└pX< ╨ T aä@∞=┐ ╨ß|XX
Row 12 `@ ⌠⌠ <òh áH╝ É ░░>Ec
Row 13 el ≡┴
Row 14 w d ?┴Æα p$ α É?
Row 15 ╠Φ!@Çh ■K $P P$Θσαá
//order member function
void TicketManager::order(int number, int rowNum, int startNum, char& purchase)
{
bool order = true;
for(int x =0; x < number; x++)
{
if(aud[rowNum][startNum + x].valid == '*')
{
cout << "Seats are not available" << endl;
order = false;
purchase = 'N';
break;
}
}
if(order)
{
cout << "The number of seats are " << number << endl;
cout << "The price for each seat: $" << aud[rowNum][0].cost << endl;
cout << "The total cost is: $" << aud[rowNum][0].cost * number << endl;
cout << endl;
cout << "Do you want to purchase these seats? (Y/N) ";
cin >> purchase;
}
}
//update seats member function
void TicketManager::update(int number, int row, int colum)
{
for(int x = 0; x < number; x++)
{
aud[row][colum + x].valid = '*';
}
}
//print member function
void TicketManager::print()
{
for(int row = 0; row < 15; row++)
{
for(int col = 0; col < 30; col++)
{
whenever you open a file it is your obligation to check if that file opened successfully, otherwise you might be using an invalid filestream.
1 2 3 4 5 6 7 8 9 10 11
std::ifstream fileprices("SeatPrices.dat");///this stream might fail if the file isn't in the working dir
if(fileprices)
{
///use fileprices
}
else
///handle stream errors