so here's the code.

#include<stdio.h>
#include<conio.h>

void main()
{struct
 {
  char seat;
 }a[19];
 int x,z;
 char y;
 a[0].seat='A';
 a[1].seat='B';
 a[2].seat='C';
 a[3].seat='D';
 a[4].seat='A';
 a[5].seat='B';
 a[6].seat='C';
 a[7].seat='D';
 a[8].seat='A';
 a[9].seat='B';
 a[10].seat='C';
 a[11].seat='D';
 a[12].seat='A';
 a[13].seat='B';
 a[14].seat='C';
 a[15].seat='D';
 a[16].seat='A';
 a[17].seat='B';
 a[18].seat='C';
 a[19].seat='D';
 clrscr();
 printf("Flight Seat Reservation:");
 printf("\n\n\n\t1\t%c\t%c\t%c\t%c", a[0].seat, a[1].seat, a[2].seat, a[3].seat);
 printf("\n\t2\t%c\t%c\t%c\t%c", a[4].seat, a[5].seat, a[6].seat, a[7].seat);
 printf("\n\t3\t%c\t%c\t%c\t%c", a[8].seat, a[9].seat, a[10].seat, a[11].seat);
 printf("\n\t4\t%c\t%c\t%c\t%c", a[12].seat, a[13].seat, a[14].seat, a[15].seat);
 printf("\n\t5\t%c\t%c\t%c\t%c", a[16].seat, a[17].seat, a[18].seat, a[19].seat);
 for(z=0;z<=20;++z)
 {printf("\n\nEnter your row number:\n");
  scanf("%d", &x);
  if(x==1||x==2||x==3||x==4||x==5)
    {printf("\n\nEnter your seat letter:\n");
     scanf("%s", &y);
      if(y!='a'&&y!='A'&&y!='b'&&y!='B'&&y!='c'&&y!='C'&&y!='d'&&y!='D')
       {printf("\n\nSorry, you have entered a wrong seat letter.");
	printf("\n\nPlease enter another seat letter: ");
	scanf("%s", &y);}}
  else
     {printf("\n\nSorry you have entered a wrong row number");
      printf("\n\nPlease enter seat number again: \n");
      scanf("%d", &x);
      printf("\n\nEnter your seat letter:\n");
      scanf("%s", &y);};
  if(x==1)
     {if(y=='a'||y=='A')
       a[0].seat='*';
      else if(y=='b'||y=='B')
       a[1].seat='*';
      else if(y=='c'||y=='C')
       a[2].seat='*';
      else if(y=='d'||y=='D')
       a[3].seat='*';}
   else if(x==2)
      {if(y=='a'||y=='A')
	a[4].seat='*';
       else if(y=='b'||y=='B')
	a[5].seat='*';
       else if(y=='c'||y=='C')
	a[6].seat='*';
       else if(y=='d'||y=='D')
	a[7].seat='*';}
   else if(x==3)
      {if(y=='a'||y=='A')
	a[8].seat='*';
       else if(y=='b'||y=='B')
	a[9].seat='*';
       else if(y=='c'||y=='C')
	a[10].seat='*';
       else if(y=='d'||y=='D')
	a[11].seat='*';}
   else if(x==4)
      {if(y=='a'||y=='A')
	a[12].seat='*';
       else if(y=='b'||y=='B')
	a[13].seat='*';
       else if(y=='c'||y=='C')
	a[14].seat='*';
       else if(y=='d'||y=='D')
	a[15].seat='*';}
   else if(x==5)
      {if(y=='a'||y=='A')
	a[16].seat='*';
       else if(y=='b'||y=='B')
	a[17].seat='*';
       else if(y=='c'||y=='C')
	a[18].seat='*';
       else if(y=='d'||y=='D')
	a[19].seat='*';}
   printf("Flight Seat Reservation:");
   printf("\n\n\n\t1\t%c\t%c\t%c\t%c", a[0].seat, a[1].seat, a[2].seat, a[3].seat);
   printf("\n\t2\t%c\t%c\t%c\t%c", a[4].seat, a[5].seat, a[6].seat, a[7].seat);
   printf("\n\t3\t%c\t%c\t%c\t%c", a[8].seat, a[9].seat, a[10].seat, a[11].seat);
   printf("\n\t4\t%c\t%c\t%c\t%c", a[12].seat, a[13].seat, a[14].seat, a[15].seat);
   printf("\n\t5\t%c\t%c\t%c\t%c", a[16].seat, a[17].seat, a[18].seat, a[19].seat);}
  getch();
  }

the problem is every time i change

if(y!='a'&&y!='A'&&y!='b'&&y!='B'&&y!='c'&&y!='C'&&y!='d'&&y!='D')
       {printf("\n\nSorry, you have entered a wrong seat letter.");
	printf("\n\nPlease enter another seat letter: ");
	scanf("[B]%s[/B]", &y);}}

with %c, it won't allow the user to enter a letter and skips to "Sorry, you have entered a wrong seat letter" and even if i don't change it to %c, it won't change the a[].seat to '*'.
T_T

and i'm not sure about the for loop, can someone help me?
help will be very much appreciated, thanks.

It would take a post several pages long to detail all the problems and inefficiencies in this code. I don't know where to start. It is a mess. A real mess.

But the good news is that at least you had an attempt at writing some code.

But here are a few pointers (unintentional bad 'C' pun there).

1) You don't need a struct if you only have 1 member of the struct.

2) Use toupper to replace all those ungainly boolean expressions.
Replace
if (y=='a'||y=='A')
with
y= toupper (y)
if (y=='A')

3) Use case statements rather than if then else, as appropriate.

4) Don't use x,y,z,a,b, as variable names. Use meaningful names, like Row and SeatLetter.

5) If your seats are arranged in a grid, use a two dimensional array to model them.

6) Use a for loop to initialize the values. You have to imagine how your code would work if you had 900 seats instead of your current 20 seats.

7) Replace that massive if then else block with one line of code that directly sets the value, like
Seats[x][y-'A'] = '*';

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.