#include<stdio.h>
#include<conio.h>
void Seat();
void Display();
int main()
{
c
printf("\n\n");
printf(" -----------------------------------------------\n");
printf("\t\t |\tUNIVERSITY ============ ====== ===== \t |\n");
printf("\n\t\t | ///// CAMPUS \t\t |\n");
printf("\n\t\t | ONlINE ADMISSION PORTAL |\n");
printf(" -----------------------------------------------\n");
printf("\n\n");
int choice ;
printf(" Select your Choice:\n\n");
printf(" 1 - Seats Reservation Menu\n");
printf(" 2 - Display Avilable & Reserved Seats\n");
printf(" 3 - Exit\n");
printf("\n Please select your choice (1 to 3)\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
Seat();
break;
case 2:
Display();
break;
}
getch();
return 0;
}
int row = 6; // variables declared
int seat = 12;
int num_of_seats=0;
char display[6][12] = {{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},};
// printf("\n\n");
void Seat()
{
int num;
printf(" How many Seats would you like to reserve?\n");
scanf("%d",&num);
if (num < 1 || num > 50 )
{
printf(" ERROR - Number of Seats must be 1 to 50");
// break;
}
int n;
for (n = 1; n <= num; n++)
{
int r = 0;
int s = 0;
printf("Please enter row (1 - 5) followed by space then seat number (1-10) for seat number %d", n );
scanf("%d %d",&r,&s);
if( r < 1 || r > 5)
{
printf(" ERROR - row must be 1 to 5");
}
if (s < 1 || s > 10)
{
printf(" ERROR - seat must be 1 to 10");
}
if ( display [r][s] == 'R')
{
printf(" ERROR - Seat is Reserve. Please choose Avilable Seat\n");
break;
}
if (r == 1)
{
display[r][s] = 'R' ;
}
if (r == 2)
{
display [r][s] = 'R' ;
}
if (r == 3)
{
display [r][s] = 'R' ;
}
if ( r == 4)
{
display [r][s] = 'R' ;
}
if ( r == 5)
{
display [r][s] = 'R' ;
}
}
num_of_seats += num;
}
void Display()
{
printf(" Seat No. 1 2 3 4 5 6 7 8 9 10\n");
// Seats Reserved and seats remaining
// variables declared
int r;
for (r = 1; r < row; r++)
{
printf("Row Number %d",r);
int s;
for ( s = 1; s < seat; s++)
{
printf("%d",display[r][s]);
}
printf("\n");
}
printf("The number Reserve seats is %d",num_of_seats);
printf("The number Availabe seats is %d",50-num_of_seats);
//break;
// default:
//printf("\n");
}
#include<conio.h>
void Seat();
void Display();
int main()
{
c
printf("\n\n");
printf(" -----------------------------------------------\n");
printf("\t\t |\tUNIVERSITY ============ ====== ===== \t |\n");
printf("\n\t\t | ///// CAMPUS \t\t |\n");
printf("\n\t\t | ONlINE ADMISSION PORTAL |\n");
printf(" -----------------------------------------------\n");
printf("\n\n");
int choice ;
printf(" Select your Choice:\n\n");
printf(" 1 - Seats Reservation Menu\n");
printf(" 2 - Display Avilable & Reserved Seats\n");
printf(" 3 - Exit\n");
printf("\n Please select your choice (1 to 3)\n");
scanf("%d",&choice);
switch(choice)
{
case 1:
Seat();
break;
case 2:
Display();
break;
}
getch();
return 0;
}
int row = 6; // variables declared
int seat = 12;
int num_of_seats=0;
char display[6][12] = {{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},
{"#" "#" "#" "#" "#" "#" "#" "#" "#" "#" "#"},};
// printf("\n\n");
void Seat()
{
int num;
printf(" How many Seats would you like to reserve?\n");
scanf("%d",&num);
if (num < 1 || num > 50 )
{
printf(" ERROR - Number of Seats must be 1 to 50");
// break;
}
int n;
for (n = 1; n <= num; n++)
{
int r = 0;
int s = 0;
printf("Please enter row (1 - 5) followed by space then seat number (1-10) for seat number %d", n );
scanf("%d %d",&r,&s);
if( r < 1 || r > 5)
{
printf(" ERROR - row must be 1 to 5");
}
if (s < 1 || s > 10)
{
printf(" ERROR - seat must be 1 to 10");
}
if ( display [r][s] == 'R')
{
printf(" ERROR - Seat is Reserve. Please choose Avilable Seat\n");
break;
}
if (r == 1)
{
display[r][s] = 'R' ;
}
if (r == 2)
{
display [r][s] = 'R' ;
}
if (r == 3)
{
display [r][s] = 'R' ;
}
if ( r == 4)
{
display [r][s] = 'R' ;
}
if ( r == 5)
{
display [r][s] = 'R' ;
}
}
num_of_seats += num;
}
void Display()
{
printf(" Seat No. 1 2 3 4 5 6 7 8 9 10\n");
// Seats Reserved and seats remaining
// variables declared
int r;
for (r = 1; r < row; r++)
{
printf("Row Number %d",r);
int s;
for ( s = 1; s < seat; s++)
{
printf("%d",display[r][s]);
}
printf("\n");
}
printf("The number Reserve seats is %d",num_of_seats);
printf("The number Availabe seats is %d",50-num_of_seats);
//break;
// default:
//printf("\n");
}