Below is my C code, one problem is that when I try to run it, it wont continue to printf the next statement after the switch and after I put in the input. It's a lecture hall/room booking system.If you saw, there is step 3 after the if else switch statement. It wont print out the step 3.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char applicant_name[100], applicant_faculty[100], applicant_date[40], applicant_id[50], applicant_mobile_number[20];
int number_of_students, lecture_hall_book, lecture_room;
char lecture_hall[20], booking_date[20];
printf("\n=======================================================================================\n");
printf(" Author : Fathul Amin\n");
printf(" Matric ID : CB19070\n");
printf("=======================================================================================\n\n");
printf(" Universiti Malaysia Pahang\n\n");
printf(" Welcome to the Faculty of Computing (FCOM) Lecture Hall/Room Booking System\n\n");
printf(" For your information, this system was created to support\n");
printf(" government initiative to reduce paper usage by replacing the \n");
printf(" manual application form to a computerized system \n\n\n");
printf(" There will be 3 STEP to apply for a booking\n\n");
printf("\t [STEP 1] Application Information\n");
printf("\t [STEP 2] Determine Lecture Hall/Room based on Number of Students\n");
printf("\t [STEP 3] Lecture Hall/Room Booking Date\n\n");
printf("\t [STEP 4] Lecture Hall/Room Booking Time\n\n");
printf("\n=======================================================================================");
printf("\n [STEP 1] Below is an example of information needed");
printf("\n=======================================================================================\n\n");
printf(" APPLICANT INFORMATION\n\n");
printf(" NAME : _____________ STAFF/STUDENT ID : ______________\n\n");
printf(" FACULTY : _____________ MOBILE NUMBER : ______________\n\n");
printf(" DATE : _____________ (xx/xx/xxxx)\n");
printf("\n=======================================================================================\n\n");
printf(" Enter Your Name : ");
fgets(applicant_name, 100, stdin);
printf(" Enter Your Faculty : ");
fgets(applicant_faculty, 100, stdin);
printf(" Enter Today's Date : ");
fgets(applicant_date, 40, stdin);
printf(" Enter Your Staff/Student ID : ");
fgets(applicant_id, 50, stdin);
printf(" Enter Your Mobile Number : ");
fgets(applicant_mobile_number, 20, stdin);
printf("\n\n=======================================================================================\n");
printf(" [STEP 2] Number of Students");
printf("\n=======================================================================================\n\n");
printf("\t\t\t Enter Number of Students: ");
scanf("%i", &number_of_students);
printf("\n=======================================================================================\n\n");
if(number_of_students > 50 && number_of_students<101){
printf("\t\tLecture Hall : [1] YDK1\n");
printf("\t\t\t\t[2] YDK2\n");
printf("\t\t\t\t[3] YDK3\n");
printf("\t\t\t\t[4] YDK4\n");
printf("\t\t\t\t[5] YDK5\n\n");
printf(" Which Lecture Hall do you want to book? (1-5): \n");
scanf("%i", &lecture_hall_book);
switch(lecture_hall_book){
case 1 : printf("YDK1 Confirmed");
strcpy(lecture_hall, "XBK1");
break;
case 2 : printf("YDK2 Confirmed");
strcpy(lecture_hall, "XBK2");
break;
case 3 : printf("YDK3 Confirmed");
strcpy(lecture_hall, "XBK3");
break;
case 4 : printf("YDK4 Confirmed");
strcpy(lecture_hall, "XBK4");
break;
case 5 : printf("YDK5 Confirmed");
strcpy(lecture_hall, "XBK5");
break;
}
} else if(number_of_students<50) {
printf("\t\t\tLecture Room : [1] XBK1\n");
printf("\t\t\t\t\t [2] XBK2\n");
printf("\t\t\t\t\t [3] XBK3\n");
printf("\t\t\t\t\t [4] XBK4\n");
printf("\t\t\t\t\t [5] XBK5\n");
printf("\t\t\t\t\t [6] XBK6\n");
printf("\t\t\t\t\t [7] XBK7\n");
printf("\t\t\t\t\t [8] XBK8\n");
printf("\t\t\t\t\t [9] XBK9\n");
printf("\t\t\t\t\t[10] XBK10\n\n");
printf(" Which Lecture Room do you want to book? (1-10): ");
scanf("%i", &lecture_hall_book);
switch(lecture_hall_book){
case 1 : printf("\n\n\t\t\t\t XBK1 CONFIRMED");
strcpy(lecture_room, "XBK1");
break;
case 2 : printf("\n\n\t\t\t\t XBK2 CONFIRMED");
strcpy(lecture_room, "XBK2");
break;
case 3 : printf("\n\n\t\t\t\t XBK3 CONFIRMED");
strcpy(lecture_room, "XBK3");
break;
case 4 : printf("\n\n\t\t\t\t XBK4 CONFIRMED");
strcpy(lecture_room, "XBK4");
break;
case 5 : printf("\n\n\t\t\t\t XBK5 CONFIRMED");
strcpy(lecture_room, "XBK5");
break;
case 6 : printf("\n\n\t\t\t\t XBK6 CONFIRMED");
strcpy(lecture_room, "XBK6");
break;
case 7 : printf("\n\n\t\t\t\t XBK7 CONFIRMED");
strcpy(lecture_room, "XBK7");
break;
case 8 : printf("\n\n\t\t\t\t XBK8 CONFIRMED");
strcpy(lecture_room, "XBK8");
break;
case 9 : printf("\n\n\t\t\t\t XBK9 CONFIRMED");
strcpy(lecture_room, "XBK9");
break;
case 10 : printf("\n\n\t\t\t\t XBK10 CONFIRMED");
strcpy(lecture_room, "XBK10");
break;
default : printf("You didnt enter anything");
}
} else {
printf(" There is no Lecture Hall that can fit students more than 100\n");
printf(" Maximum is 100 students for a lecture hall and 50 for a lecture room");
}
if()
printf("\n=======================================================================================\n\n");
printf("\n [STEP 3] Lecture Hall/Room Booking Date");
printf("\n=======================================================================================\n\n");
printf(" Enter Booking Date: ");
fgets(booking_date, 20, stdin);
printf("\n\n=======================================================================================\n");
printf(" [STEP 4] Lecture Hall/Room Booking Time");
printf("\n=======================================================================================\n\n");
printf("\n\t\t\t\tEXAMPLE (24 Hour Format)");
printf("\n\t\t\t\t From : 0830");
printf("\n\t\t\t\t To : 1030");
printf("\n\t\t\t\t 08 ---> Hours In");
printf("\n\t\t\t\t 30 ---> Hours Out");
printf("\n\t\t\t\t 10 ---> Minutes In");
printf("\n\t\t\t\t 30 ---> Minutes Out");
return 0;
}