I just need help in making a "*" change into a "X" when I enter the row and column numbers. I can't use <window.h> due to me having a Mac PLEASE HELP!
MY CODE:
#include <iostream>
#include<fstream>
#include<iostream>
#include<cstring>
#include <string>
#include<array>
using namespace std;
void makeReservation ( int &a, int &b)
{
int beta[a][b];
if ( beta [a][b]=='X')
{
cout<< "Seat is already taken";
}
else if(beta[a][b]=='*')
{
for(int i=0; i<13;i++)
{
for(int j=0;j<6; j++)
{
if( beta [a][b]==beta[i][j])
beta [a][b]='X';
else
beta[i][j] = '*';
}
}
}
}
void displayMap (char matrix[13][6])
{
cout<<"Seats ABCDEF"<<endl;
for(int i=0; i<13;i++)
{
cout << "Row " << (i+1) << " ";
for(int j=0;j<6; j++)
{
cout<< matrix[i][j];
}
cout<<endl;
}
}
int main()
{
char again= ' ';
cout<< "would you like to reserve a seat? (Y/N): ";
cin>> again;
again ='Y';
while(again == 'Y')
{
cout<< "Rows 1-3 are first-class seats" <<endl;
cout<< "Rows 5-13 are economy seats"<<endl;
cout<< "X = seat is occupied"<<endl;
cout<< "* = seat is available"<<endl;
cout<<"_____________________________________________________________________________________________________________"<<endl;
char alpha[13][6];
for(int i=0; i<13;i++)
{
for(int j=0;j<6; j++)
{
alpha[i][j] = '*';
}
}
displayMap(alpha);
int x,y;
cout<< "Which row would you want: ";
cin>> x;
cout<<"Which column would you want:";
cin>>y;
makeReservation (x,y);
cout<< "Enter another seat? (Y/N) ";
cin>> again;
cout<<endl;
cout<<"\n";
}}