• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 27 رای - 2.67 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: سورس کد مدیریت حسابداری هتل (سی پلاس پلاس)
حالت موضوعی
#1
سورس زیر که مدربوط به مدیریت حسابداری هتل میباشد که به زبان سی پلاس پلاس نوشته شده است.
سورس کد:
کد:
#include <dos.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <graphics.h>

#define NUM 5
#define PH 8
#define MPH 12
#define MIN 30
#define MAX 61
#define DAY 3
void box(int,int,int,int);
void main1();
void add();              // Ask user for input.
void about();
void view();         // Diplay all the record one by one.
void bill();
void viewall();      // Diplay all the record.
void searchname();   // Search for a record.
void searchid();     // Search for a record.
void c_id();
void c_name();       // Changes the name in a record.
void c_add();        // Changes the address in a record.
void c_days();      // Changes the connection type in a record.
void del();          // Deletes a record.
int date(void);      // This fucntion is for displaying System Date.

void check_id(char *,int);         //Checks for the length and validity of Member ID
void check_name(char *,int);    //Checks for the length and validity of Name
void check_add(char *,int);     //Checks for the length and validity of Address
void check_days(char *,int);   //Checks for the CONNECTION TYPE
void check_phone(char *,int);   //Checks for the length and validity of Phone Number
void check_mphone(char *,int);  //Checks for the length and validity of Mobile Number
int duplicate(char idno[]);      //Checks for the Duplication of the Member ID
int passprotec();


void empty();


struct customer
{
    char id[NUM];           /* ID of Length 4 integers*/
    char name[MIN];        /* Name of Length 30 characters*/
    char fname[MIN];     /* Father's Name 30 characters*/
    char address[MAX];     /* Address of Length 61 alphanumeric*/
    char phone[PH];        /* Phone Number of Length 8 integers*/
    char mphone[MPH];    /* Mobile Number of Length 12 integers*/
    char days[DAY];    /* Blood Group */
    int  day;            /* It is used to display the day of length 2*/
    int  month;          /* It is used to display the month of length 2*/
    int  year;           /* it is used to display the year*/
}rec;

//---------------------------Main-------------------------------------------
main()
{
    passprotec();
    return 0;
}
int passprotec()
{


   //    clrscr();
    char ch,pws[50],cpass[50],fname[50];
    int i,j,pcnt,k,ccnt;
    FILE *fp;
    //    setbkcolor(BLACK);
    clrscr();

    strcpy(fname,"pass.dll");
    fp=fopen(fname,"r");

    if(fp == NULL)
    {
        printf("\n\nfile dose not found.");
        //textattr(128+7);
        printf("\nPlease any key to exit");
        getch();
        exit(1);
    }
    i=0;
    ccnt=0;
    while( (ch=fgetc(fp)) !=  EOF)
    {
        pws[i]=ch;
        ++i;
        ccnt++;
    }
    //    gotoxy(35,10);
       //    printf("HOTEL MANAGMENT SYSTEM");
  //    gotoxy(35,13);
    printf("\n\n\n\n\n\n\t\t\tEnter Your Password:");

    i=0;
    pcnt=0;
    //    textcolor(RED);
    while((ch=getch()) != 13)
    {
        //    textcolor(6);
        cprintf("*");
        cpass[i]=ch;
        i++;
        pcnt++;
    }
    printf("\n");

    if(ccnt==pcnt)
    {
        for(i=0;i<ccnt;i++)
        {
            if(pws[i]==cpass[i])
            {
                k=0;
            }
            else
            {
                k=1;
            }
        }
        if(k==0)
        {
            //    textattr(128 + 10);
            //    cprintf("\n\nPassword is Right Access is Granted !!!");
            fclose(fp);
            main1();
        }
        else
        {
            //textattr(128 + 4);
            printf("\n\n\n\t\t\tPassword is Invalid.!!!");
            getch();
            passprotec();
        }
    }
    else
    {
        //textattr(128 + 4);
        printf("\n\n\n\t\t\tPassword is Invalid.!!!");
        getch();
        passprotec();
    }
    getch();
    return 0;

}
void main1()
{
    int ch;
   int gdriver = DETECT, gmode, errorcode;

    clrscr();

   initgraph(&gdriver, &gmode, "c:\\turboc3\\bgi");
//  setcolor(GREEN);
   settextstyle(GOTHIC_FONT,HORIZ_DIR,5);
//    settextstyle(7,0,3);
//   setcolor(GREEN);
   outtextxy(60,10," Hotel Management System");

//   closegraph();
    box(8,7,72,22);
    delay(500);
    gotoxy(10,8);
    printf("1. Enter New Record");

    delay(500);
    gotoxy(45,8);
    printf("8. Change Name");

    delay(500);
    gotoxy(10,10);
    printf("2. View Record One-By-One");

    delay(500);
    gotoxy(45,10);
    printf("9. Change Address");


    delay(500);
    gotoxy(10,12);
    printf("3. View All Record");

    delay(500);
    gotoxy(45,12);
    printf("10. Change Number of days");

    delay(500);
    gotoxy(10,14);
    printf("4. Search By Room Number");

    delay(500);
    gotoxy(45,14);
    printf("11. Delete a Record");

    delay(500);
    gotoxy(10,16);
    printf("5. Search By Name");

    delay(500);
    gotoxy(45,16);
    printf("12. About Author");

    delay(500);
    gotoxy(10,18);
    printf("6. Bill");

    delay(500);
    gotoxy(45,18);
    printf("13.EXIT");

    delay(500);
    gotoxy(10,20);
    printf("7. Change Room Number");

     //    delay(1000);
      //    gotoxy(45,20);
      //    printf("14.Log Out");

    delay(500);
    box(8,23,72,25);
    delay(500);
a:
    gotoxy(10,24);
    delay(500);
    printf("Enter Your Choice [1-13]         ");
    scanf("%d",&ch);

    switch(ch)
    {
    case 1:
        {
            closegraph();
            add();
            break;
        }
    case 2:
        {
            closegraph();
            view();
            break;
        }
    case 3:
        {
            closegraph();
            viewall();
            break;
        }
    case 4:
        {
            closegraph();
            searchid();
            break;
        }
    case 5:
        {
            closegraph();
            searchname();
            break;
        }
    case 6:
        {
            closegraph();
            bill();
            break;
        }
    case 7:
        {
            closegraph();
            c_id();
            break;
        }
    case 8:
        {
            closegraph();
            c_name();
            break;
        }
    case 9:
        {
            closegraph();
            c_add();
            break;
        }
    case 10:
        {
            closegraph();
            c_days();
            break;
        }
    case 11:
        {
               closegraph();
            del();
            break;
        }
    case 12:
        {
            closegraph();
            about();
            break;
        }
    case 13:
        {
            abort();
        }
    default:
        {
            gotoxy(26,24);
            printf("<<--ENTER FROM 1-13 PLEASE-->>");    //This message will only print on INVALID ENTRY and Will ask again for input.
        }
    }


}



void add()
{

    FILE *fp;
    char ch;
    char temp[NUM];



    if(fp!=NULL)
    {
        do{
            fp=fopen("hotel.rec","ab");

            clrscr();
            box(5,2,75,15);
            gotoxy(25,2);
            printf(" ++ Adding records to database ++ ");
            do{
                gotoxy(8,5);
                printf("Enter Member ID: ");
                check_id(temp, NUM);

            }

            while(duplicate(temp));             //This Condition Will keep on executng till a non duplicate ID is entered.

            strcpy(rec.id, temp);             //After verifying, ID in 'temp' will copy to 'rec.id'

            gotoxy(8,6);
            printf("Enter Name : ");
            check_name(rec.name,MIN);          //It will verify that no neumerical input is given & the name input should not exceed the length limit
            gotoxy(8,7);
            printf("Enter Father's Name : ");
            check_name(rec.fname,MIN);      //It will verify that no neumerical input is given & the name input should not exceed the length limit
            gotoxy(8,8);
            printf("Enter Address : ");
            check_add(rec.address,MAX);        //It will verify that only alpha neumeric input is entered & should not exceed the length limit
            gotoxy(8,9);
            printf("Enter Phone Number : ");
            check_phone(rec.phone,PH);        //It will verify phone number of a particular length
            gotoxy(8,10);
            printf("Enter Mobile Number : ");
            check_mphone(rec.mphone,MPH);   //It will verify mobile number of a particular length
            gotoxy(8,11);
            printf("Enter Number of Days to stay : ");
            check_days(rec.days, DAY);  //It will allow user to enter the blood group no other character than A B and O +/- could be entred

            {
                struct date d;

                getdate(&d);
                gotoxy(8,12);
                printf("Date of Membership : %d-%d-%d ",d.da_day,d.da_mon,d.da_year);
                rec.day   = d.da_day;
                rec.month = d.da_mon;
                rec.year  = d.da_year;
            }

            window(1,1,80,25);
            gotoxy(1,12);

            fwrite(&rec, sizeof(rec), 1, fp);    //Record will be written to file.

            fclose(fp);
            gotoxy(18,24);
            printf("Do you want to enter another record [Y]/[N]: ");
            ch=toupper(getche());


        }while(ch =='Y');    //Repeat loop while user inputs 'Y'

    }
    else
    {
        gotoxy(18,24);
        printf("+++ Error opening file +++");
    }
    clrscr();
    main1();
}
void view()
{
    FILE *fp;


    fp=fopen("hotel.rec","rb");

    if(fp!=NULL)
    {
        clrscr();
        while( fread(&rec, sizeof(rec), 1, fp))
            if(strcmp(rec.id," ")!=0)
            {
                /*Calling all the records saved in the database*/
                clrscr();
                box(5,2,75,15);
                gotoxy(20,2);
                printf(" ++ Viewing records from the database ++ ");
                gotoxy(8,5);
                printf(" Member ID : %s",rec.id);
                gotoxy(8,6);
                printf(" Name : %s",rec.name);
                gotoxy(8,7);
                printf(" Father's Name : %s",rec.fname);
                gotoxy(8,8);
                printf(" Address: %s",rec.address);
                gotoxy(8,9);
                printf(" Phone Number: %s",rec.phone);
                gotoxy(8,10);
                printf(" Mobile Number: %s",rec.mphone);
                gotoxy(8,11);
                printf(" Total Number of Days : %s",rec.days);
                gotoxy(8,12);
                printf(" Date of Reservation : %d-%d-%d",rec.day,rec.month,rec.year);

                getch();
            }

            if(strcmp(rec.id," ")==NULL)
            {
                clrscr();
                gotoxy(17,13);
                sound(500);delay(200);nosound();
                printf("+++ Record not found in the database +++");
                getch();
            }
            fclose(fp);
    }
    else
    {
        gotoxy(20,24);
        printf("+++ Error opening file +++");
    }
    clrscr();
    main1();
}
void searchname()
{
    char ch;
    FILE *fp;
    char name[MIN];
    clrscr();

    fp=fopen("hotel.rec","rb");

    gotoxy(20,13);
    printf("Please enter the members name :  ");
    check_name(name,MIN);

    while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(name,rec.name) );


    ch=strcmp(name,rec.name);
    if(ch!=0)
    {
        clrscr();
        sound(500);delay(200);nosound();
        gotoxy(28,13);
        printf(" +++ Record Not Found +++ ");
        getch();
    }
    else

    {
        clrscr();
        box(5,2,75,15);
        gotoxy(28,2);
        printf(" ++ Search Results ++ ");
        gotoxy(8,5);
        printf(" Member ID: %s",rec.id);

        gotoxy(8,6);
        printf(" Name : %s",rec.name);

        gotoxy(8,7);
        printf(" Fathers Name : %s",rec.fname);

        gotoxy(8,8);
        printf(" Address : %s",rec.address);

        gotoxy(8,9);
        printf(" Phone Number : %s",rec.phone);

        gotoxy(8,10);
        printf(" Mobile Number : %s",rec.mphone);

        gotoxy(8,11);
        printf(" Total Numbers of Days : %s",rec.days);
        gotoxy(8,12);
        printf(" Date of Reservation : %d-%d-%d",rec.day,rec.month,rec.year);
        getch();
    }
    fclose(fp);
    clrscr();
    main1();
}
void searchid()
{
    int ch;
    FILE *fp;
    char sno[NUM];
    clrscr();

    fp=fopen("hotel.rec","rb");

    gotoxy(20,13);
    printf("Please enter the member ID :  ");
    check_id(sno,NUM);

    while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) );


    ch=strcmp(sno,rec.id);
    if(ch!=0)
    {
        clrscr();
        sound(500);delay(200);nosound();
        gotoxy(28,13);
        printf(" +++ Record Not Found +++ ");
        getch();
    }
    else

    {
        clrscr();
        box(5,2,75,15);
        gotoxy(28,2);
        printf(" ++ Search Results ++ ");
        gotoxy(8,5);
        printf(" Member ID : %s",rec.id);

        gotoxy(8,6);
        printf(" Name : %s",rec.name);

        gotoxy(8,7);
        printf(" Father's Name : %s",rec.fname);

        gotoxy(8,8);
        printf(" Address : %s",rec.address);

        gotoxy(8,9);
        printf(" Phone Number : %s",rec.phone);

        gotoxy(8,10);
        printf(" Mobile Number : %s",rec.mphone);

        gotoxy(8,11);
        printf(" Number of Days : %s",rec.days);
        gotoxy(8,12);
        printf(" Date of Reservation : %d-%d-%d",rec.day,rec.month,rec.year);

        getch();
    }
    fclose(fp);
    clrscr();
    main1();
}
void c_name()
{
    int ch;
    FILE *fp;
    char sno[NUM];
    clrscr();

    fp=fopen("hotel.rec","rb+");

    gotoxy(20,13);
    printf("Please enter the Member ID :  ");
    check_id(sno,NUM);

    while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) );

    ch=strcmp(sno,rec.id);
    if(ch!=0)
    {
        clrscr();
        sound(500);delay(200);nosound();
        gotoxy(28,13);
        printf(" +++ Record Not Found +++ ");
        getch();
    }
    else
    {
        clrscr();
        box(5,2,75,15);
        gotoxy(28,2);
        printf(" ++ Search Results ++ ");

        gotoxy(8,5);
        printf(" Member ID : %s",rec.id);
        gotoxy(8,6);
        printf(" Name :  %s",rec.name);    // This will print the old name already stored.
        gotoxy(8,10);
        printf(" New Name : ");            // This will allow the user to change the old name and input a new name.
        check_name(rec.name,MIN);          // The check will validate each character entered turn by turn.

        fseek(fp, ftell(fp) - sizeof(rec),0);
        fwrite(&rec, sizeof(rec), 1, fp); //The new name will be added to the database.

        gotoxy(28,24);
        printf(" +++ Database Updated +++ ");

        getch();
    }
    fclose(fp);
    clrscr();
    main1();
}
void c_add()
{
    int ch;
    FILE *fp;
    char sno[NUM];
    clrscr();

    fp=fopen("hotel.rec","rb+");

    gotoxy(20,13);
    printf("Please enter member ID : ");
    check_id(sno,NUM);

    while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) );

    ch=strcmp(sno,rec.id);  // Here the result after comparing the values of the two strings by using the 'strcmp' function is assigned to 'ch'.
    if(ch!=0)            // This loop will execute if the Member's ID dont compare.
    {
        clrscr();
        sound(500);delay(200);nosound();
        gotoxy(28,13);
        printf(" +++ Record Not Found +++ ");
        getch();
    }
    else                 // If the Member's ID match, then this block will be executed.
    {
        clrscr();
        box(5,2,75,15);
        gotoxy(28,2);
        printf(" ++ Search Results ++ ");
        gotoxy(8,5);
        printf(" Member ID: %s",rec.id);
        gotoxy(8,6);
        printf(" Name : %s",rec.name);
        gotoxy(8,7);
        printf(" Address : %s",rec.address);
        gotoxy(8,10);
        printf(" Enter New Address : ");
        check_add(rec.address,MAX);

        fseek(fp, ftell(fp) - sizeof(rec),0);    //fseek sets the file pointer associated with a stream to a new position.
        fwrite(&rec, sizeof(rec), 1, fp);       //fwrite appends a specified number of equal-sized data items to an output file.

        gotoxy(28,24);
        printf(" +++ Database Updated +++ ");

        getch();
    }
    fclose(fp);
    clrscr();
    main1();
}
void c_days()
{
    int ch;
    FILE *fp;
    char sno[NUM];
    clrscr();

    fp=fopen("hotel.rec","rb+");

    gotoxy(20,13);
    printf("Please enter member ID :  ");
    check_id(sno,NUM);

    while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) );

    ch=strcmp(sno,rec.id);
    if(ch!=0)
    {
        clrscr();
        sound(500);delay(200);nosound();
        gotoxy(28,13);
        printf(" +++ Record Not Found +++ ");
        getch();
    }
    else
    {
        clrscr();
        box(5,2,75,15);
        gotoxy(28,2);
        printf(" ++ Search Results ++ ");
        gotoxy(8,5);
        printf(" Member ID : %s",rec.id);
        gotoxy(8,6);
        printf(" Name : %s",rec.name);
        gotoxy(8,7);
        printf(" Number of Days : %s",rec.days);    //Old Blood Group is displayed

        gotoxy(8,10);
        printf(" Enter New Number of days : "); //New Blood Group is asked for Input.
        check_days(rec.days, DAY);       //This check checks that only A B O +/- are entred.

        fseek(fp, ftell(fp) - sizeof(rec),0);
        fwrite(&rec, sizeof(rec), 1, fp);

        window(1,1,80,25);
        gotoxy(1,12);
        gotoxy(28,24);
        printf(" +++ Database Updated +++ ");

        getch();
    }
    fclose(fp);
    clrscr();
    main1();
}
void del()
{
    int ch;
    FILE *fp;
    char sno[NUM];
    clrscr();

    fp=fopen("hotel.rec","rb+");

    gotoxy(20,13);
    printf("Please enter member ID :  ");
    check_id(sno,NUM);

    while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) );

    ch=strcmp(sno,rec.id);
    if(ch!=0)
    {
        clrscr();
        sound(500);delay(200);nosound();
        gotoxy(28,13);
        printf(" +++ Record Not Found +++ ");
        getch();
    }
    else     //Here the saved record is displayed.
    {
        clrscr();
        box(5,2,75,15);
        gotoxy(28,2);
        printf(" ++ Search Results ++ ");
        gotoxy(8,5);
        printf(" Member ID: %s",rec.id);

        gotoxy(8,6);
        printf(" Name : %s",rec.name);

        gotoxy(8,7);
        printf(" Father's Name : %s",rec.fname);

        gotoxy(8,8);
        printf(" Address : %s",rec.address);

        gotoxy(8,9);
        printf(" Phone Number: %s",rec.phone);

        gotoxy(8,10);
        printf(" Mobile Number: %s",rec.mphone);

        gotoxy(8,11);
        printf(" Number of Days : %s",rec.days);
        gotoxy(8,12);
        printf(" Date of Reservatiion : %d-%d-%d",rec.day,rec.month,rec.year);

        gotoxy(23,24);
        printf("Do You Want To Delete this Record [Y/N] ");
        ch=toupper(getche());
        if (ch=='Y')
        {
            empty(); //this is a Function which will erase the record in memory & NOT physically.
            fseek(fp, ftell(fp) - sizeof(rec), 0);
            fwrite(&rec, sizeof(rec), 1, fp);
            clrscr();
            sound(500);delay(200);nosound();

            gotoxy(28,24);
            printf(" +++ Record Deleted +++ ");

            getch();
        }

    }

    fclose(fp);
    clrscr();
    main1();
}
void check_id(char *p, int size)
{
    int i=0;
    char ch;

    do
    {
        ch=getch();

        if( (ch>='0' && ch<='9') && (i<size-1) )
        {
            *p=ch;             //The value is assigned to the pointer.
            p++;               //Pointer is incremented.
            i++;               //Length counter is incremented.
            printf("%c",ch); //Validated character is printed.
        }
        else      //This block of commands controls backspace.
            if(ch==8 && i>0)
            {
                printf("%c%c%c",8,32,8);
                i--;              //Length counter is decremented.
                p--;              //Pointer is decremented.
            }

    }while(ch!=13 || i<size-1);//this loop will continue till the total given length is reached or 'ENTER' is pressed.

    *p='\0';

}
void check_phone(char *ph, int size)
{
    int p=0;
    char s[20],ch;

    do
    {
        ch=getch();

        if( ((ch>='0' && ch<='9')||(ch=='-')) && (p<size-1) )
        {
            *ph=ch;
            ph++;
            p++;
            printf("%c",ch);
        }

        else

            if( (ch==8)&&(p>0) )
            {
                printf("%c%c%c",8,32,8);
                p--;
                ph--;
            }

    }while(ch!=13 || p<size-1);

    s[p]='\0';
    *ph='\0';

}
void check_mphone(char *ph, int size)
{
    int p=0;
    char s[20],ch;

    do
    {
        ch=getch();

        if( ((ch>='0' && ch<='9')||(ch=='-')) && (p<size-1) )
        {
            *ph=ch;
            ph++;
            p++;
            printf("%c",ch);
        }

        else

            if( (ch==8)&&(p>0) )
            {
                printf("%c%c%c",8,32,8);
                p--;
                ph--;
            }

    }while(ch!=13 || p<size-1);

    s[p]='\0';
    *ph='\0';

}
void check_name(char *p, int size)
{
    int j=0;
    char x[40],cj;

    do
    {

        cj=toupper(getch());

        if(((cj>='a' && cj<='z')||(cj>='A' && cj<='Z')||(cj==' ')) && (j<size-1))
        {
            *p++=cj;
            j++;
            printf("%c",cj);
        }

        else

            if(cj==8 && j>0)
            {
                printf("%c%c%c",8,32,8);
                j--; p--;
            }

    }while(cj!=13);

    x[j]='\0';
    *p='\0';
}
void check_add(char *p, int size)
{
    int l=0;
    char a[50],ad;

    do
    {

        ad=toupper(getch());

        if(((ad>='a' && ad<='z')||(ad>='A' && ad<='Z')||(ad==' ')||(ad=='-')||(ad==',')||(ad=='/')||(ad=='.')||(ad>='0' && ad<='9')) && (l<size-1))
        {
            *p++=ad;
            l++;
            printf("%c",ad);
        }

        else

            if( (ad==8)&&(l>0) )
            {
                printf("%c%c%c",8,32,8);
                l--; p--;
            }

    }while(ad!=13);

    a[l]='\0';   *p='\0';
}
void check_days(char *p, int size)
{
    int i=0;
    char ch;

    do
    {
        ch=getch();

        if( (ch>='0' && ch<='9') && (i<size-1) )
        {
            *p=ch;             //The value is assigned to the pointer.
            p++;               //Pointer is incremented.
            i++;               //Length counter is incremented.
            printf("%c",ch); //Validated character is printed.
        }
        else      //This block of commands controls backspace.
            if(ch==8 && i>0)
            {
                printf("%c%c%c",8,32,8);
                i--;              //Length counter is decremented.
                p--;              //Pointer is decremented.
            }

    }while(ch!=13 || i<size-1);//this loop will continue till the total given length is reached or 'ENTER' is pressed.

    *p='\0';

}

int duplicate(char idno[])
{
    FILE *fp;

    fp=fopen("hotel.rec","rb");

    while(fread(&rec, sizeof(rec), 1, fp) && strcmp(rec.id, idno));
    fclose(fp);

    if(strcmp(rec.id, idno)==0)
        return 1;
    else
        return 0;
}
void viewall()
{
    FILE *pt;
    int x=6;
    pt = fopen("hotel.rec", "rb");
    clrscr();
    box(3,2,79,25);
    gotoxy(25,2);
    printf(" ++ All records of database ++ ");
    gotoxy(6,4);
    printf("Room No.  Name                           Phone No.   Mobile No.   No. Of Days");

    while ((fread(&rec,sizeof(rec),1,pt)==1))
    {
        if(x==21)
        {
            gotoxy(6,23);
            printf("Press any key to continue...");
            getch();
            clrscr();
            box(3,2,79,25);
            gotoxy(25,2);
            printf(" ++ All records of database ++ ");
            gotoxy(6,4);
            printf("Room No.  Name                           Phone No.   Mobile No.   No. Of Days");
            x=6;
        }
        else
        {
            gotoxy(6,x);
            printf("%s",rec.id);
            gotoxy(14,x);
            printf("%s",rec.name);
            gotoxy(46,x);
            printf("%s",rec.phone);
            gotoxy(56,x);
            printf("%s",rec.mphone);
            gotoxy(71,x);
            printf("%s",rec.days);
            x++;
        }
    }
    fclose(pt);
    getch();
    main1();
}
void empty()
{
    strcpy(rec.id," ");
    strcpy(rec.name," ");
    strcpy(rec.fname," ");
    strcpy(rec.address," ");
    strcpy(rec.phone," ");
    strcpy(rec.mphone," ");
    strcpy(rec.days," ");
    rec.day=0;
    rec.month=0;
    rec.year=0;
}
void c_id()
{
    int ch;
    FILE *fp;
    char sno[NUM];
    clrscr();

    fp=fopen("hotel.rec","rb+");

    gotoxy(20,13);
    printf("Please enter member ID :  ");
    check_id(sno,NUM);

    while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) );

    ch=strcmp(sno,rec.id);
    if(ch!=0)
    {
        clrscr();
        sound(500);delay(200);nosound();
        gotoxy(28,13);
        printf(" +++ Record Not Found +++ ");
        getch();
    }
    else
    {
        clrscr();
        box(5,2,75,15);
        gotoxy(28,2);
        printf(" ++ Search Results ++ ");
        gotoxy(8,5);
        printf(" Member ID : %s",rec.id);
        gotoxy(8,6);
        printf(" Name : %s",rec.name);

        gotoxy(8,10);
        printf(" Enter New Room Number : "); //New Blood Group is asked for Input.
        check_id(rec.id, NUM);       //This check checks that only A B O +/- are entred.

        fseek(fp, ftell(fp) - sizeof(rec),0);
        fwrite(&rec, sizeof(rec), 1, fp);

        window(1,1,80,25);
        gotoxy(1,12);
        gotoxy(28,24);
        printf(" +++ Database Updated +++ ");

        getch();
    }
    fclose(fp);
    clrscr();
    main1();
}
void bill()
{
    int ch;
    float b;
    FILE *fp;
    char sno[NUM],temp;
    clrscr();

    fp=fopen("hotel.rec","rb");

    gotoxy(20,13);
    printf("Please enter the member ID :  ");
    check_id(sno,NUM);

    while ( fread(&rec, sizeof(rec), 1, fp) && strcmp(sno,rec.id) );


    ch=strcmp(sno,rec.id);
    if(ch!=0)
    {
        clrscr();
        sound(500);delay(200);nosound();
        gotoxy(28,13);
        printf(" +++ Record Not Found +++ ");
        getch();
    }
    else

    {
        clrscr();
        box(5,2,75,15);
        gotoxy(28,2);
        printf(" ++ Billing ++ ");
        gotoxy(8,5);
        printf(" Member ID : %s",rec.id);

        gotoxy(8,6);
        printf(" Name : %s",rec.name);

        gotoxy(8,7);
        printf(" Father's Name : %s",rec.fname);

        gotoxy(8,8);
        printf(" Address : %s",rec.address);

        gotoxy(8,9);
        printf(" Phone Number : %s",rec.phone);

        gotoxy(8,10);
        printf(" Mobile Number : %s",rec.mphone);

        gotoxy(8,11);
        printf(" Number of Days : %s",rec.days);
        gotoxy(8,12);
        printf(" Date of Reservation : %d-%d-%d",rec.day,rec.month,rec.year);
        b=atof(rec.days);
        gotoxy(8,13);
        printf(" Bill %.2f",(b * 500));
        getch();
    }
    fclose(fp);
    clrscr();
    main1();
}
void about ()
{
    clrscr();
    box(18,4,65,6);
      //    gotoxy(30,3);
      //    textcolor(GREEN);
    //    printf("Hotel Managmnet System");
    gotoxy(32,5);
    printf("   ABOUT PROGRAMER   ");
    textbackground(0);
    box(18,7,65,25);
    gotoxy (35,10);
    textcolor (GREEN);
    cprintf ("Made By");
    gotoxy (33,11);
    textcolor(7);
    cprintf ("Kalola Sandip");
    gotoxy (33,12);
    textcolor(7);
    cprintf ("Sutariya Ashvin");
    gotoxy (33,13);
    textcolor(7);
    cprintf ("Vaghela Jay");
    gotoxy (35,15);
    textcolor (GREEN);
    cprintf ("Presented To");
    gotoxy (33,16);
    textcolor (7);
    cprintf ("Mr Jatin Kothari");
    gotoxy (36,18);
    textcolor (GREEN);
    cprintf ("Project On");
    gotoxy (30,19);
    textcolor (7);
    cprintf ("Hotel Management System");
    gotoxy (33,21);
    textcolor(GREEN);
    cprintf ("Contact Information");
    gotoxy (30,22);
    textcolor (7);
    cprintf("sandipkalola1990@gmail.com");
       //    gotoxy (29,21);
      //    textcolor (7);
      //    cprintf ("www.atozbca.somee.com");
    //    gotoxy (20,24);
    //    textcolor (WHITE);
    //    cprintf ("DK SOFTWARE SOLUTION");
    getch();
    clrscr();
    main1();
}
void box(int a,int b,int c,int d)
{
    int i,j;
    for(i=a;i<c;i++)
        {
        gotoxy(i,b);printf("\xcd");
        gotoxy(i,d);printf("\xcd");
        }
    for(j=b;j<d;j++)
        {
        gotoxy(a,j);printf("\xba");
        gotoxy(c,j);printf("\xba");
        }
    gotoxy(a,b);printf("\xc9");
    gotoxy(c,b);printf("\xbb");
    gotoxy(a,d);printf("\xc8");
    gotoxy(c,d);printf("\xbc");
}
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  سورس کد خواندن فایل تکست (سی پلاس پلاس) Amin_Mansouri 2 9,139 09-05-2017، 12:08 PM
آخرین ارسال: ehsan.bc12
  گرافیک در سی پلاس پلاس jupiter2050 9 22,805 05-31-2014، 03:17 PM
آخرین ارسال: cnmeysam
  بهترین محیط (ide) برای برنامه نویسی c++ سی پلاس پلاس Amin_Mansouri 0 9,143 06-06-2013، 04:01 PM
آخرین ارسال: Amin_Mansouri
  سورس کد ایجاد افکت های مورد نظر (سی پلاس پلاس) Amin_Mansouri 0 4,989 12-06-2012، 12:29 PM
آخرین ارسال: Amin_Mansouri
  سورس کد دانلودر(سی پلاس پلاس) Amin_Mansouri 0 6,343 09-17-2012، 07:08 PM
آخرین ارسال: Amin_Mansouri
  سورس کد Thrip Port Scanner Amin_Mansouri 0 6,740 09-13-2012، 05:04 PM
آخرین ارسال: Amin_Mansouri
  سورس های ++C Ghoghnus 6 10,846 07-12-2012، 08:46 AM
آخرین ارسال: امیر
  سورس کد اینکریپت و دیکریپت (سی) Amin_Mansouri 1 4,983 07-07-2012، 05:13 PM
آخرین ارسال: one hacker alone
  سورس کد نمایش حجم فایل مورد نظر (سی) Amin_Mansouri 0 3,905 06-16-2012، 08:32 PM
آخرین ارسال: Amin_Mansouri
  سورس کد تبدیل مگابایت به کیلوبایت (سی) Amin_Mansouri 0 5,506 06-16-2012، 08:28 PM
آخرین ارسال: Amin_Mansouri

پرش به انجمن:


Browsing: 1 مهمان