Visual C++ Program for the Implementation of Bus Reservation System | IT1253 - Software Engineering Laboratory


ABSTRACT:
The aim of our project is to develop a software for implementing “Bus Reservation System” using VISUAL C++. The development of this particular project is to perform the formalities / operation in Bus Reservation System. This project deals with the customer details in its process. The customers are instructed in an easy way to feel comfortable with the processing.

REQUIREMENT ANALYSIS:

SOFTWARE REQUIREMENTS:
    Front End   :    ‘C++’ language.
    Back End   :     File Management System (using Dat files)

    Operating system:    Any Operating System (Window or Linux)

HARDWARE REQUIREMENTS:
    Processor     :     3.06 GHZ operating speed.
    Hard Disk    :      80GB Capacity.
    RAM           :       256MB
    Monitor       :       CRT 17’
    Mouse         :       OPTICAL
    Keyboard    :       Alphanumeric keys.
     The specified hardware requirements are the minimum requirements that are needed to implement in the project.

FUNCTIONAL REQUIREMENTS:
    As mentioned in the requirements, the Hospital Management system involves the following function or process
Bus Reservation System consists of four modules. They are
    Module 1: Insertion Module
    Module 2: Deletion Module
    Module 3: Display Module
    Module 4: Exit
  Insert Module:
     In this module the user enters the detail of the patient.
  Delete Module:
     In this module the user deletes the detail of the patient.
  Display Module:
     This module display the detail of the patient.
  Exit:
     In this module the user can quit from the project.

SOURCE CODE:
#include<windows.h>
#include<sql.h>
#include<sqlext.h>
#include<stdio.h>
#define TEST_LEN 50
int main()
{

    int c;
    char ch='y';
    SQLINTEGER totalseats,seatsrequired,passengerage;
    SQLCHAR busname[TEST_LEN+1], passengername[TEST_LEN+1],
        destination[TEST_LEN+1];
    HENV hEnv=NULL;
    HDBC hDBC=NULL;
    HSTMT hStmt=NULL;
    UCHAR szSqlStr[]="insert into ninerow(busname,passengername,passengerage,destination,totalseats,seatsrequired) values(?,?,?,?,?,?)";
        UCHAR szSqlStr1[]="delete*from ninerow where passengername = ?";
    UCHAR szSqlStr2[]="select*from ninerow";
    UCHAR szDSN[SQL_MAX_DSN_LENGTH]="ninerow ";
    UCHAR *szUID=NULL;
    UCHAR *szPasswd=NULL;
    UCHAR szModel1[128], szModel2[128], szModel3[128], szModel4[128], szModel5[128], szModel6[128];
    SDWORD cbModel1,cbModel2,cbModel3,cbModel4,cbModel5,cbModel6;
    SDWORD cbtest=SQL_NTS;
    RETCODE retcode;
    do
    {
    printf("\t BUS RESERVATION SYSTEM\n");
    printf("\t 1.entry module\t2.cancellation module\t 3.display module\n");
    printf("entr ur option\n");
    scanf("%d",&c);
    switch(c)
    {
    case 1:
    printf("\tEntry module\n");
    printf("Enter the bus name\n");
    scanf("%s",&busname);
    printf("entr te passenger name\n");
    scanf("%s",&passengername);
    printf("Enter the passenger age\n");
    scanf("%d",&passengerage);
    printf("destination\n");
    scanf("%s",&destination);
    printf("total seats\n");
    scanf("%d",&totalseats);
    printf("seats reqd\n");
    scanf("%d",&seatsrequired);
    SQLAllocEnv(&hEnv);
    SQLAllocConnect(hEnv,&hDBC);
    retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
    if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
    {
    retcode=SQLAllocStmt(hDBC,&hStmt);
    retcode=SQLPrepare(hStmt,szSqlStr,sizeof(szSqlStr));
SQLBindParameter(hStmt,1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,busname,0,&cbtest);
SQLBindParameter(hStmt,2,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,passengername,0,&cbtest);
SQLBindParameter(hStmt,3,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&passengerage,0,&passengerage);
SQLBindParameter(hStmt,4,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,destination,0,&cbtest);
SQLBindParameter(hStmt,5,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&totalseats,0,&totalseats);
SQLBindParameter(hStmt,6,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&seatsrequired,0,&seatsrequired);
    retcode=SQLExecute(hStmt);
    printf("record is inserted\n");

    }
    break;
    case 2:
    printf("\t cancellation module\n");
    SQLAllocEnv(&hEnv);
    SQLAllocConnect(hEnv,&hDBC);
    retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
    {
    retcode=SQLAllocStmt(hDBC,&hStmt);
    retcode=SQLPrepare(hStmt,szSqlStr1,sizeof(szSqlStr1));
    SQLBindParameter(hStmt,1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,passengername,0,&cbtest);
        printf("entr the passenger name\n");
    scanf("%s",&passengername);
    retcode=SQLExecute(hStmt);
    printf("record is del\n");
    }
    break;
    case 3:
    printf("\tdisplay module\n");
    SQLAllocEnv(&hEnv);
    SQLAllocConnect(hEnv,&hDBC);
    retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
    if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
    {
    retcode=SQLAllocStmt(hDBC,&hStmt);
    retcode=SQLPrepare(hStmt,szSqlStr2,sizeof(szSqlStr2));
    retcode=SQLExecute(hStmt);
        SQLBindCol(hStmt,1,SQL_C_CHAR,szModel1,sizeof(szModel1),&cbModel1);
    SQLBindCol(hStmt,2,SQL_C_CHAR,szModel2,sizeof(szModel2),&cbModel2);
    SQLBindCol(hStmt,3,SQL_C_CHAR,szModel3,sizeof(szModel3),&cbModel3);
    SQLBindCol(hStmt,4,SQL_C_CHAR,szModel4,sizeof(szModel4),&cbModel4);
    SQLBindCol(hStmt,5,SQL_C_CHAR,szModel5,sizeof(szModel5),&cbModel5);
    SQLBindCol(hStmt,6,SQL_C_CHAR,szModel6,sizeof(szModel6),&cbModel6);
    retcode=SQLFetch(hStmt);
    printf("\tbname\tpname\tpage\tdest\ttotal\tseats\n\n");
        while(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
    {
    printf("\t%s\t%s\t%s\t%s\t%s\t%s\n",szModel1,szModel2,szModel3,szModel4,szModel5,szModel6);
    retcode=SQLFetch(hStmt);
    }
    }
    break;
    }
    flushall();
    printf("Do u wan to continue:  ");
    scanf("%s",&ch);
    }while(ch=='y');
    return 0;
}

CONCLUSION:
             The  project we have done here is “BUS RESERVATION SYSTEM” using C language.
In this project we have designed a software to implement the customer details that any user can perform
it in a simple and a better way. This way of format helps us to have clear database.
Previous
Next Post »

Still not found what you are looking for? Try again here.