hi, i'm new in this site.. i'm working on a airplane seat reservation program..
we were asked to design a program that chooses the users' desired row number and the desired seat number (or rather in this case, seat letter)... here's my code
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
struct flight_reservation
{ int a[21];
};
char c, s;
clrscr();
printf("Enter your choice");
printf(" a. View all seats\n");
printf(" b. Reserve a seat\n");
printf(" c. Exit");
scanf("%c",&c);
switch(c)
{case 'a': {clrscr();
printf("1.\tA\tB\tC\tD\n");
printf("2.\tA\tB\tC\tD\n");
printf("3.\tA\tB\tC\tD\n");
printf("4.\tA\tB\tC\tD\n");
printf("5.\tA\tB\tC\tD\n");
getch();} break;
case 'b': {int w, y;
char s[21]={'A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D','A','B','C','D'};
printf("Choose row");
scanf("%d",&w);
switch(w)
case 1: printf("Choose a column"); scanf("%c",&s);
{int v;
for(v=0;v<20;v++)
if(s[v]='A'||s[v]='B'||s[v]='C'||s[v]='D')
s[v]='*'}
printf("%s",s)break;
case 2: printf("Choose a column"); scanf("%c",&s);
int v;
for(v=0;v<20;v++)
if(s[v]='A'||s[v]='B'||s[v]='C'||s[v]='D')
s[v]='*'}
printf("%s",s) break;
case 3: printf("Choose a column"); scanf("%c",&s);
int v;
for(v=0;v<20;v++)
if(s[v]='A'||s[v]='B'||s[v]='C'||s[v]='D')
s[v]='*'}
printf("%s",s) break;
case 4: printf("Choose a column"); scanf("%c",&s);
int v;
for(v=0;v<20;v++)
if(s[v]='A'||s[v]='B'||s[v]='C'||s[v]='D')
s[v]='*'}
printf("%s",s) break;
case 5: printf("Choose a column"); scanf("%c",&s);
int v;
for(v=0;v<20;v++)
if(s[v]='A'||s[v]='B'||s[v]='C'||s[v]='D')
s[v]='*'}
printf("%s",s) break;
}
case 'c': clrscr();
printf("Thanks! Come Again!");
getch();
exit(0);
default: printf("Invalid Input!");
getch();
}
well, my problem is, it doesn't work after the user inputs his/her desired row number.. the program just exits... and i'm not even sure if it will work out well.... please, i just need some help... thanks...