Codes of Movies Form
Codes of Movies Form
h>
#include <stdlib.h>
#include <string.h>
#define MAX_MOVIES 10
#define MAX_NAME_LENGTH 50
#define MAX_SEATS 50
typedef struct {
char tle[MAX_NAME_LENGTH];
char genre[MAX_NAME_LENGTH];
int seats[MAX_SEATS];
} Movie;
// Func on prototypes
int main() {
Movie movies[MAX_MOVIES];
int numMovies;
scanf("%d", &numMovies);
do {
scanf("%d", &choice);
switch (choice) {
case 1:
displayMovies(movies, numMovies);
break;
case 2:
bookTicket(movies, numMovies);
break;
case 3:
prin ("Thank you for using the Movie Ticket Booking System.\n");
break;
default:
return 0;
scanf("%d", &movieChoice);
scanf("%d", &numSeats);
// Check if movie choice is valid
return;
int availableSeats = 0;
if (movies[movieChoice - 1].seats[i] == 0) {
availableSeats++;
return;
int seat;
scanf("%d", &seat);
} else {
movies[movieChoice - 1].seats[seat - 1] = 1;
}
prin ("Booking successful!\n");