Question
MAKING PROJECT IN C# FOR BUS RESERVATION SYSTEM. PLEASE ADD THE FEATURE FOR BAS DEPARTURE AND DESTINATION INSIDE THE CODING BELOW. ALSO, I NEED FLOWCHART
MAKING PROJECT IN C# FOR BUS RESERVATION SYSTEM.
PLEASE ADD THE FEATURE FOR BAS DEPARTURE AND DESTINATION INSIDE THE CODING BELOW.
ALSO, I NEED FLOWCHART FOR THIS PROGRAM. PLEASE HELP ME
#include
int main() { login(); int num,i; do{ system("cls"); printf(" "); printf("====================================== WELCOME TO BUS RESERVATION SYSTEM ====================================== "); printf("\t\t\t\t\t[1]=> View Bus List "); printf(" "); printf("\t\t\t\t\t[2]=> Book Tickets "); printf(" "); printf("\t\t\t\t\t[3]=> Cancle Booking "); printf(" "); printf("\t\t\t\t\t[4]=> Bus Status Board "); printf(" "); printf("\t\t\t\t\t[5]=> Exit "); printf("=============================================================================================================== "); printf("\t\t\tEnter Your Choice:: "); scanf("%d",&num); switch(num) { case 1: bus();//for list of bus break; case 2: booking();//for booking the tickets break; case 3: cancle(); break; case 4: status(); break; } getch(); }while(num != 5); system("CLS"); printf("\t---------------------------------------------------------------------------------------------------------- "); printf("\t\t\t\t\tThank You For Using This System\t\t\t\t\t\t "); printf("\t---------------------------------------------------------------------------------------------------------- "); printf("\t\t\t Brought To You By code-projects.org"); getch(); return 0; }
void bus() { system("cls"); printf(" "); printf("=========================================== BUS RESERVATION SYSTEM ============================================ "); printf("\t\t\t\t\t[1] => %s ",ch[0]); printf(" "); printf("\t\t\t\t\t[2] => %s ",ch[1]); printf(" "); printf("\t\t\t\t\t[3] => %s ",ch[2]); printf(" "); printf("\t\t\t\t\t[4] => %s ",ch[3]); printf(" "); printf("\t\t\t\t\t[5] => %s ",ch[4]); }
void booking() {
int i=0; char numstr[100]; system("cls"); printf("=========================================== BUS RESERVATION SYSTEM ============================================ ");//for entering train number bus();//for seeing train least printf("Enter the Bus number:--->"); scanf("%d",&trno); system("cls"); printf("=========================================== BUS RESERVATION SYSTEM ============================================ ");//for selecting coach printf("Your Bus Number is %d ********** %s",trno,ch[trno-1]); status_1(trno); FILE *f1, *fopen();//for reading the seats from the user. char str1[80]="32",str2[4],str3[4]; int seat1,seat2,booking=0; if(trno == 1) { f1 = fopen("tr1.txt","r+"); fgets(str1,80,f1); fclose(f1); }else if(trno == 2) { f1 = fopen("tr2.txt","r+"); fgets(str1,80,f1); fclose(f1); }else if(trno == 3) { f1 = fopen("tr3.txt","r+"); fgets(str1,80,f1); fclose(f1); } else if(trno == 4) { f1 = fopen("tr4.txt","r+"); fgets(str1,80,f1); fclose(f1); } else if(trno == 5) { f1 = fopen("tr5.txt","r+"); fgets(str1,80,f1); fclose(f1); } seat1=atoi(str1);//covert the string into number if(seat1 <= 0) { printf("There is no blank seat in this bus "); }else { printf(" \t\t\t\tAvailable Seats:------>%d ",seat1); printf(" \t\t\t\tNumber of Tickets:----->"); scanf("%d",&booking); printf(" ");
seat1=seat1-booking; itoa(trno,numstr,10); name_number(booking,numstr); printf(" \t\t\t\tThe Total booking amount is %d",200*booking); itoa(seat1, str1, 10); //for reading the seats from the user. if(trno == 1) { f1 = fopen("tr1.txt","w"); fputs(str1,f1); fclose(f1); } else if(trno == 2) { f1 = fopen("tr2.txt","w"); fputs(str1,f1); fclose(f1); } else if(trno == 3) { f1 = fopen("tr3.txt","w"); fputs(str1,f1); fclose(f1); } else if(trno == 4) { f1 = fopen("tr4.txt","w"); fputs(str1,f1); fclose(f1); } else if(trno == 5) { f1 = fopen("tr5.txt","w"); fputs(str1,f1); fclose(f1); } } }
void name_number(int booking,char numstr[100]) { char tempstr[100],tempstr1[12]="status",tempstr2[12]="number"; int number; FILE *a,*b; int i=0; strcat(numstr,".txt"); strcat(tempstr1,numstr); strcat(tempstr2,numstr); a = fopen(tempstr1,"a");//for open the file to write the name in the file b = fopen(tempstr2,"a");//for open the file for writing the number in the file for(i=0; i
} fclose(a); fclose(b); }
int read_number(int trno)//for putting the numeric value in the array { char tempstr[100],tempstr2[12]="number"; FILE *a,*b; char numstr[100]; int i=0,j=0,k; itoa(trno,numstr,10); strcat(numstr,".txt"); strcat(tempstr2,numstr); a = fopen(tempstr2,"a+");//for open the file to write the name in the file while(!feof(a)) { number[i][j] = fgetc(a);
if(number[i][j] == ' ') { j=0; i++; } else { j++; } } k=i; for(i=0; i void read_name(int trno)//for putting the numeric value in the array { char tempstr1[12]="status"; FILE *b; char numstr[100]; int i=0,j=0,k=0; itoa(trno,numstr,10); strcat(numstr,".txt"); strcat(tempstr1,numstr); b = fopen(tempstr1,"a+");//for open the file to write the name in the file while(!feof(b)) { name[i][j] = fgetc(b); if(name[i][j] == ' ') { j=0; i++; } else { j++; } } name[i][j]='\0'; k=i; fclose(b); } void status() { system("cls"); printf("=========================================== BUS RESERVATION SYSTEM ============================================ "); int i,trno,index=0,j; printf("Enter the number of bus:---->"); scanf("%d",&trno); j=read_number(trno); read_name(trno); printf("____________________________________________________________________________________________________________________ "); printf(" Bus.no-->%d---->%s ",trno,ch[trno-1]); printf("____________________________________________________________________________________________________________________ "); char tempname[33][10]={"Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty "}; for(i=0; i void status_1(int trno) { printf("Your Bus Number is %d ********** %s",trno,ch[trno-1]); system("cls"); printf("=========================================== BUS RESERVATION SYSTEM ============================================ "); int i,index=0,j; j=read_number(trno); read_name(trno); char tempname[33][10]={"Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty ","Empty "}; for(i=0; i void cancle() { int seat_no,i,j; char numstr[100],tempstr2[15]="number",tempstr1[15]="status"; printf("Enter the bus number:---->"); scanf("%d",&trno); itoa(trno,numstr,10); strcat(numstr,".txt"); strcat(tempstr1,numstr); strcat(tempstr2,numstr); read_number(trno); read_name(trno); status_1(trno); printf("Enter the seat number:--->"); scanf("%d",&seat_no); FILE *a,*b; a = fopen(tempstr1,"w+"); b = fopen(tempstr2,"w+"); for(i=0; i<32; i++) { if(num1[i] == seat_no) { for(j=0; j<32; j++) { if(num1[j] != seat_no && num1[j] != 0) { fprintf(b,"%d ",num1[j]); fprintf(a,"%s",name[j]); } else if(num1[j] == seat_no && num1[j] != 0) { strcpy(name[j],"Empty "); } } } } fclose(a); fclose(b); printf(" "); printf("====================================================================================================== "); printf("\t\t\t\tYour 200 rupees has been Returned\t\t\t "); printf("====================================================================================================== "); } void login() { int a=0,i=0; char uname[10],c=' '; char pword[10],code[10]; char user[10]="user"; char pass[10]="pass"; do { system("cls"); printf(" ========================= LOGIN FORM ========================= "); printf(" ENTER USERNAME:-"); scanf("%s", &uname); printf(" ENTER PASSWORD:-"); while(i<10) { pword[i]=getch(); c=pword[i]; if(c==13) break; else printf("*"); i++; } pword[i]='\0'; //char code=pword; i=0; //scanf("%s",&pword); if(strcmp(uname,"user")==0 && strcmp(pword,"pass")==0) { printf(" WELCOME TO OUR SYSTEM !!!! LOGIN IS SUCCESSFUL"); printf(" \t\t\t\tPress any key to continue..."); getch();//holds the screen break; } else { printf(" SORRY !!!! LOGIN IS UNSUCESSFUL"); a++; getch();//holds the screen } } while(a<=2); if (a>2) { printf(" Sorry you have entered the wrong username and password for four times!!!"); getch(); } system("cls"); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started