Good day to all of you. I'm looking for advice for my code below.
My code was intend to print out a set of asterisk base on the rows and columns in my array(cinema[20][23]).
The code works fine and i was trying to print out numbers (which is from 1 to 20) on the 1st row of my array.
Hope that any codemaster here can point out a little bit things that i have miss out.....
#include <iostream.h>
int main()
{
char alpha[20] = {' ','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S'};
int row, column;
char cinema[20][23] = {0};
for(row= 0; row < 7 ; row++)
{ cout<<alpha[row]<<" ";
for(column = 0; column < 23; column++)
{
if(column == 0 || column == 5 || column == 18)
{cout<<" ";
}
else if(column < 4)
{ cout<<"* ";
}
else if(column > 4 && column <=17)
{ cout<<"* ";
}
else if(column < 23)
{ cout<<"* ";
}
}
cout<<endl; //endline for one row
}
for(row = 7; row < 14 ; row ++)
{
if(row == 7)
{ cout<<" ";
}
else
{ cout<<alpha[row - 1]<<" ";
for(column = 0 ; column < 23; column++)
{
if(column == 0 || column == 5 || column == 18)
{cout<<" ";
}
else if(column < 4)
{ cout<<"* ";
}
else if(column > 4 && column <=17)
{ cout<<"* ";
}
else if(column < 23)
{ cout<<"* ";
}
}
}
cout<<endl;
}
for(row = 15; row < 20 ; row++)
{ if(row == 15)
{cout<<" ";
}
else
{ cout<<alpha[row - 3]<<" ";
for(column = 0 ; column < 23; column++)
{ if(column == 0 || column == 5 || column == 18)
{cout<<" ";
}
else if(column < 4)
{ cout<<"* ";
}
else if(column > 4 && column <=17)
{ cout<<"* ";
}
else if(column < 23)
{ cout<<"* ";
}
}
}
cout<<endl;
}
return 0;
}