CSE-104 Lab Project Presentation
CSE-104 Lab Project Presentation
Introduction
Objectives
Existing System
System Result
Software Requirement
Conclusion
Introduction 04
05
OBJECTIVES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char ch[20][450]={"Green Line","Volvo Travels","Shohag Express","Desh Travels","National Travels","Saudia Travels","Ena Travels"};
int busno;
void bus();
void booking();
void login()
{
int a=0, i=0;
char username[10],c=' ';
char pword[10], code[10];
char user[10] ="project";
char pass[10] ="cse";
do
{
system("cls");
printf ("\n =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= LOGIN FORM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= ");
printf (" \n ENTER YOUR USERNAME:-");
scanf ("%s", &username);
printf (" \n ENTER YOUR PASSWORD:-");
while (i<10)
{ Existing System
pword[i]=getch();
c=pword[i];
07
if(c==13)
break;
else
printf ("*");
i++;
}
pword[i]='\0';
i=0;
if (strcmp(username,"project")==0 && strcmp(pword,"cse")==0)
{
printf (" \n\n\n YOUR LOGIN IS SUCCESSFUL");
printf (" \n\n\n WELCOME TO OUR ONLINE RESERVATION SYSTEM");
printf ("\n\n\n\t\t\t\tPress any key to continue your reservation...");
getch();
break;
}
else
{
printf ("\n SORRY !!!! YOUR LOGIN IS UNSUCESSFUL");
a++;
getch();
}
} while (a<=2);
if (a>2)
{
printf("\nSorry you have entered the wrong username and password for more times!!!");
getch();
}
system("cls");
} //========>>>>>>>>>End of Login function
int main()
{ Existing System
login();
int num;
08
do
{ system("cls");
printf ("\n\n\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= WELCOME TO BUS RESERVATION SYSTEM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
printf ("\t\t\t\t[1]=> View Our Bus List\n\n");
printf ("\t\t\t\t[2]=> Booking Your Tickets\n\n");
printf ("\t\t\t\t[3]=> Cancle Your Booking\n\n");
printf ("\t\t\t\t[4]=> Bus Status Board\n\n");
printf ("\t\t\t\t[5]=> Exit\n\n");
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n");
printf ("\t\t\tEnter Your Choice:: ");
scanf ("%d",&num);
switch (num)
{ case 1:
bus();
break;
case 2:
booking();
break;
case 3:
cancle();
break;
case 4:
status();
break;
} getch();
} while (num != 5);
system("cls");
{ printf ("\t-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n");
printf ("\n\t\t\t\t\tThank You For Using This System\t\t\t\t\t\t\n\n");
printf ("\t-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n");
} return 0;
} //=================>>>>>>>>>>>End of Main function
Existing System
09
void bus()
{
system("cls");
printf ("\n\n\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
printf ("\t\t\t\t\t[1] => %s\n\n",ch[0]);
printf ("\t\t\t\t\t[2] => %s\n\n",ch[1]);
printf ("\t\t\t\t\t[3] => %s\n\n",ch[2]);
printf ("\t\t\t\t\t[4] => %s\n\n",ch[3]);
printf ("\t\t\t\t\t[5] => %s\n\n",ch[4]);
printf ("\t\t\t\t\t[6] => %s\n\n",ch[5]);
printf ("\t\t\t\t\t[7] => %s\n\n",ch[6]);
}
void bus_details()
{
system("cls");
printf ("\n\n\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
printf ("\t\t\t\t\t[1] Dhaka to Cox's Bazar ==> %s\n\n",ch[0]);
printf ("\t\t\t\t\t[2] Dhaka to Sylhet ======> %s\n\n",ch[1]);
printf ("\t\t\t\t\t[3] Dhaka to Khulna ======> %s\n\n",ch[2]);
printf ("\t\t\t\t\t[4] Dhaka to Mymensingh ==> %s\n\n",ch[3]);
printf ("\t\t\t\t\t[5] Dhaka to Bandarban ===> %s\n\n",ch[4]);
printf ("\t\t\t\t\t[6] Dhaka to Chittagong ===> %s\n\n",ch[5]);
printf ("\t\t\t\t\t[7] Dhaka to Rajshahi ====> %s\n\n",ch[6]);
}
void booking()
{
int i=0;
char numstr[100];
Existing System
10
system("cls");
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
bus();
printf ("Enter the Bus number:--->");
scanf ("%d",&busno);
system("cls");
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= BUS RESERVATION SYSTEM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n");
printf ("Your Bus Number is %d ********** %s",busno,ch[busno-1]); else if (busno == 4)
{
status_1(busno); f1 = fopen("tr4.txt","r+");
FILE *f1, *fopen(); fgets(str1,80,f1);
char str1[80]="32",str2[4],str3[4]; fclose(f1);
int seat1,seat2,booking=0; }
if (busno== 1) else if (busno == 5)
{ {
f1 = fopen("tr1.txt","r+"); f1 = fopen("tr5.txt","r+");
fgets(str1,80,f1); fgets(str1,80,f1);
fclose(f1); fclose(f1);
} }
else if (busno == 2) else if (busno == 6)
{ {
f1 = fopen("tr2.txt","r+"); f1 = fopen("tr6.txt","r+");
fgets(str1,80,f1); fgets(str1,80,f1);
fclose(f1); fclose(f1);
} }
else if (busno == 3) else if (busno == 7)
{ {
f1 = fopen("tr3.txt","r+"); f1 = fopen("tr7.txt","r+");
fgets(str1,80,f1); fgets(str1,80,f1);
fclose(f1); fclose(f1);
} }
Existing System
11
seat1=atoi(str1); //=======>>>>>>covert string into the number else if (busno == 3)
if (seat1 <= 0) {
{ f1 = fopen("tr3.txt","w");
printf ("There is no blank seat in this bus "); fputs(str1,f1);
} fclose(f1);
else }
{ else if (busno == 4)
printf ("\n\n\n\t\t\t\tAvailable Seats:------>%d\n",seat1); {
printf ("\n\t\t\t\tNumber of Tickets:----->"); f1 = fopen("tr4.txt","w");
scanf ("%d",&booking); fputs(str1,f1);
fclose(f1);
seat1=seat1-booking; }
itoa(busno,numstr,10); else if (busno == 5)
name_number(booking,numstr); {
f1 = fopen("tr5.txt","w");
printf ("\n\t\t\t\tThe Total booking amount is %d",200*booking); fputs(str1,f1);
itoa(seat1, str1, 10); fclose(f1);
} }
else if (busno == 6)
if (busno == 1) {
{ f1 = fopen("tr6.txt","w");
f1 = fopen("tr1.txt","w"); fputs(str1,f1);
fputs(str1,f1); fclose(f1);
fclose(f1); }
} else if (busno == 7)
else if (busno == 2) {
{ f1 = fopen("tr7.txt","w");
f1 = fopen("tr2.txt","w"); fputs(str1,f1);
fputs(str1,f1); fclose(f1);
fclose(f1); }
} }
Existing System
12
char name[32][100]={'\0'};
void name_number(int booking,char numstr[100])
{
char tempstr[100],tempstr1[12]="status",tempstr2[12]="number";//Declare the variable for name & seat number
int number, i;
FILE *a,*b;
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,"b");//======>>>>>>for open the file for writing the number in the file
for (i=0; i<booking; i++)//======>>>>>>for input the person name and seat number in the file
{
printf ("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Enter the details for ticket no %d =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n\n",i+1);
printf ("\t\t\t\tEnter the seat number:--->");
scanf ("%d",&number);
printf ("\t\t\t\tEnter the name of person:--->");
scanf ("%s",name[number-1]);
printf ("\n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n\n");
j = read_number(busno);
read_name(busno);
system("cls");
printf ("____________________________________________________________________________________________________________________\n\n");
printf (" Bus.no--> %d ----> %s \n",busno,ch[busno-1]);
printf ("____________________________________________________________________________________________________________________\n");
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 "};
j=read_number(busno);
read_name(busno);
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<j; i++)
{
strcpy(tempname[num1[i]],name[i]);
}
for (i=0; i<8; i++)
{
printf ("\t\t\t\t");
for (j=0; j<4; j++)
{
printf ("%d.%s\t",index+1,tempname[index+1]);
index++;
}
printf ("\n");
}
}
Existing System
16
void cancle() for (i=0; i<32; i++)
{ {
int seat_no, i, j; if (num1[i] == seat_no)
char numstr[100], tempstr2[15]="number", tempstr1[15]="status"; {
for (j=0; j<32; j++)
printf("Enter the bus number:---->"); {
scanf("%d",&busno); if (num1[j] != seat_no && num1[j] != 0)
{
itoa(busno,numstr,10); fprintf(b,"%d ",num1[j]);
strcat(numstr,".txt"); fprintf(a,"%s",name[j]);
strcat(tempstr1,numstr); }
strcat(tempstr2,numstr); else if (num1[j] == seat_no && num1[j] != 0)
read_number(busno); {
read_name(busno); strcpy(name[j],"Empty ");
status_1(busno); }
}
printf ("Enter the seat number:--->"); }
scanf ("%d",&seat_no); }
fclose(a);
FILE *a,*b; fclose(b);
a = fopen(tempstr1,"w+");
b = fopen(tempstr2,"w+"); printf("\n\
n=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n");
printf("\t\t\t\tYour 200 Taka has been Returned\t\t\t\n");
printf("=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=\n");
}
System Result
17
System Result
18
System Result
19
Software Requirement 20
For develop this system here I use the Code Blocks and C programming language .
Conclusion 21