Ads

Friday, 5 January 2018

Hotel management program in c++ with output

Visual C++ Program for the Implementation of Hotel Management


#include<iostream.h>
#include<string.h>
#include<dos.h>
#include<process.h>
#include<conio.h>
#include<stdio.h>
class HOTEL
{
public:
void screen()
{ int i;
gotoxy(20,8);
for(i=1;i<=40;i++)
{
cout<<"*";
}
for(i=8;i<=23;i++)
{
gotoxy(60,i);
cout<<"*";
}
for(i=9;i<=23;i++)
{
gotoxy(20,i);
cout<<"*";
}
for(i=1;i<=40;i++)
{
cout<<"*";
}
}
void welcome()
{
gotoxy(36,10);
cout<<"C++ PROJECT";
gotoxy(40,11);
cout<<"ON";
gotoxy(33,12);
cout<<"HOTEL MANAGEMENT";
gotoxy(25,15);
cout<<"Made by:-";
gotoxy(25,16);
cout<<"ASTHA and DIKSHA BHASIN";
gotoxy(25,18);
cout<<"Submitted to:-";
gotoxy(25,19);
cout<<"Mrs. VENUKA";
gotoxy(25,21);
cout<<"Press ENTER to continue....";
getch();

}
void login()
{                        int ch;
gotoxy(35,10);
cout<<"Login Screen";
gotoxy(30,12);
gotoxy(25,12);
cout<<"1. Administrator Login";
gotoxy(25,13);
cout<<"2. Customer Login";
gotoxy(25,14);
cout<<"3. Exit";
gotoxy(25,16);
cout<<"Enter Choice    ";
cin>>ch;
clrscr();
switch(ch)
{
                               case 1: admin();
                                          getch();
                                          break;
                               case 2:
                                         break;
                               case 3: exit(0);
}
}
void admin()
{
clrscr();
screen();
char login[30];
char password[30];
gotoxy(33,10);
cout<<"Login Id:  ";
gets(login);
gotoxy(33,12);
cout<<"Password:  ";
int i=0;
while(1)
{
                         char ch=getch();
                         if(ch==8)
                         {
if(i!=0)
{
                                    cout<<"\b";
                                    cout<<" ";
                                    cout<<"\b";
                                    i--;

                               }
                      }
                     else if(ch==13)
                     {
                           break;
                     }
                    else
                    {
password[i]=ch;
cout<<"*";
i++;
                     }
}
password[i]='\0';
int m=strcmp(login,"astha");
int n=strcmp(password,"diksha");
if(m==0 && n==0)
{
clrscr();
screen1();
}
else
{
gotoxy(25,15);
cout<<"Incorrect Login Id or Password";
gotoxy(25,17);
char max;
cout<<"Do you want  to continue y/n.... ";
cin>>max;
if(max=='y'||max=='Y')
{
                                 clrscr();
                                 screen();
                                 admin();
}
else
{
                             exit(0);
}
}
}
void screen1()
{
int i;
gotoxy(35,4);
cout<<"Welcome To";
gotoxy(33,5);
cout<<"PARADISE HOTEL";
gotoxy(10,6);
for(i=1;i<=60;i++)
{
cout<<"*";
}
for(i=6;i<=25;i++)
{
gotoxy(70,i);
cout<<"*";
}
for(i=6;i<=25;i++)
{
gotoxy(10,i);
cout<<"*";
}
for(i=1;i<=60;i++)
{
cout<<"*";
}
menu1();
}

public:void menu1()
{
int ch;
gotoxy(15,10);
cout<<"1. Add Customer";
gotoxy(15,11);
cout<<"2. Check Out Customer";
gotoxy(15,12);
cout<<"3. Search Customer";
gotoxy(15,13);
cout<<"4. Display Customer";
gotoxy(15,14);
cout<<"5. Update Customer";
gotoxy(15,15);
cout<<"6. Delete Customer";
gotoxy(15,16);
cout<<"7. Room Details";
gotoxy(15,17);
cout<<"8. Generate Bill";
gotoxy(15,18);
cout<<"9. Exit";
gotoxy(20,20);
cout<<"Enter your Choice..";
cin>>ch;
Customer k;
switch(ch)
{
case 1: clrscr();
screen();
gotoxy(33,7);
cout<<"ADD Customer                  ";
k.add();
break;
case 2: clrscr();
screen();
gotoxy(33,7);
cout<<"Check Out Customer     ";
break;
case 3: cout<<"Search Customer";
break;
case 4: cout<<"Display Customer";
break;
case 5: cout<<"Update Customer";
break;
case 6: cout<<"Delete Customer";
break;
case 7: cout<<"Room Details";
break;
case 8: cout<<"Generate Bill";
break;
case 9: exit(0);

}
  }
};

class Customer
{
       char cust_id[30];
       char cust_name[30];
       int cust_age;
       char cust_occupation[50];
       int inYear;
       int inMonth;
       int inDate;
       int otYear;
       int otMonth;
       int otDate;
       int rtype;
       int charge;
       char choice;
       public:
       void add()
       {
            gotoxy(25,10);
            cout<<"Enter customer Id: ";
            cin>>cust_id;
            gotoxy(25,11);
            cout<<"Enter customer Name: ";
            cin>>cust_name;
            gotoxy(25,12);
            cout<<"Enter customer Age: ";
            cin>>cust_age;
            gotoxy(25,13);
            cout<<"Enter customer Occupation: ";
            cin>>cust_occupation;
            gotoxy(25,14);
            cout<<"Enter customer Check In Date: ";
            gotoxy(25,15);
            cout<<"Year : ";
            cin>>inYear;
            gotoxy(25,16);
            cout<<"Month : ";
            cin>>inMonth;
            gotoxy(25,17);
            cout<<"Date : ";
            cin>>inDate;
            gotoxy(25,18);
            cout<<"Enter Room Type :- ";
            cin>>rtype;
            gotoxy(25,19);
            cout<<"Enter Room Charges :- ";
            cin>>charge;
            gotoxy(25,20);
            cout<<"Do you want to continue y/n....";
            cin>>choice;
            if(choice=='y'|| choice=='Y')
           {
   HOTEL k;
                  clrscr();
                  k.screen1();
                  k.menu1();

            }
            else
            {
                  exit(0);
             }

    }

};

void main()
{
clrscr();
HOTEL k;
k.screen();
k.welcome();
clrscr();
k.screen();
k.login();
getch();
}

This program solved by Ms Ashtha & Diksha (Presented by Jitendra Kumar JAVA Trainer at Vtech Academy of Computers)- C | C++ | DS | JAVA | Android | Python & Oracle Expert

Friday, 11 August 2017

What is list in data structure

List: - List is a linear data structure in which elements are arranged in random order. That means list is those type of linear data structure in which elements are arranged neither LIFO nor FIFO. List is implemented using array and link list.

Array has various disadvantages to handle huge no of data item in linear form. The size of array is fixed. So, memory block can be in sufficient as the requirement of the user. It is also possible that the blocks are huge in compression with the requirement of the user, So the chances of memory wastage can be maximum. 
                      
Insertion operation in array is very time consuming operation due to right shift. Operation of all elements present in the right side of the insertion point.



Similarly deletion operation in array is also a very time consuming operation due to left shift, operation of all elements present in the right side of the deletion point.

To remove the disadvantages of array, two new concepts are arise:- Dynamic memory allocation and concept of link list.

Dynamic memory allocation is those type of memory allocation process by which we can allocate memory for the variables at the time of execution using the function malloc, calloc and realloc. Using the concept of dynamic memory allocation the concept of insufficient memory and a huge memory of array can be removed. Using dynamic memory allocation user can allocate specific number of blocks for a variable as the requirement of the user. There are no chances of memory wastage or extra memory for wastage. 
 
To remove the disadvantages of array related to insertion and deletion operation. The concept of link list is arise. Link list is a linear data structure in which elements can be inserted or deleted in any order without shift operation and they are connected to each other using pointers.

This program solved by Ms Aakriti Srivastav (Guided by Jitendra Kumar JAVA Trainer at Vtech Academy of Computers)- C | C++ | DS | JAVA | Android | Python & Oracle

Saturday, 5 August 2017

How to create balance sheet - Computerized Accounting

Time Allowed:  15 Minutes                                                                                                               Total 

Read the following instructions carefully before you begin to answer the Question.
Create a Company with name System P Ltd and maintain the following Balance Sheet for the Year 1-Apr-2015.

System P Ltd
Balance Sheet
For 1-Apr-2015
Liabilities
Assets
Capital Account

2000000
Fixed Assets

640000
A's Capital A/c
800000

Computer A/c
30000

B's Capital A/c
1200000

Furniture A/c
60000

Loans (Liability)
500000
Land & Building
350000

Bank OD A/c

Plant & Machinery
200000

(Loan From HDFC)
300000

Investment
200000
Loan From Surya
200000

Fixed Deposit
200000

Current Liabilities
438000
Current Assets
2110000
Sundry Creditors
410000

Loans to Mahindra
300000

Green Laminates   60000     (PB/15-16/01)

Sundry Debtors
80000

Turbo Buiders      350000 (PB/15-16/02)

Crystal Industries   80000 (SB/15-16/01)

Outstanding Expenses

Cash and Bank

Outstanding Rent A/c
13000

Cash-in-hand
800000

Outstanding Salary A/c
15000

HDFC               430000
930000

Profit & Loss A/c
12000
   SBI                 500000

Opening Balance



Current Period
12000




Total

2950000
Total

2950000


Thursday, 3 August 2017

How Many Types of Arrays in Data Structure

Types of array 

One dimensional array-: A one dimensional array has only one  row to store value in same data type.
Syntax-: <data type> <array name> [<row size>]
Example-: int a[5]={1,2,3,4,5};
Multi dimensional array-:Multi dimensional array are derived from the basic or built in data types of c language. These includes two dimensional and three dimensional array.
Two dimensional array-: A two dimensional array has two indexes.The first index    refers to the row while the second index refers to the column.
Syntax-:<data type> <arrayname>[<row size>][< column size>]
Example-: int a[2][3]={{1,2,3),{4,5,6}}; 
Three dimensional array-:Athree dimensional array has three indexes.The first index refers to the dimension,second index refers to the row,while the third index refers to column.
Syntax-: <data type> <array name> [<dimension size>][< row         size>][<column size>]
Example-: int      a[3][2][3]={{{1,2,3},{4,5,6}},{{7,8,9},{10,11,12}},{{13,14,15},{16,17,18}}};
Example of one dimensional array (code+output)
#include<stdio.h>
#include<conio.h>
void main()
{
    int a[5],i,m;
    clrscr();
    printf("Enter the size of elements of matrix a [ max Size 5] \n");
    scanf("%d",&m);
    printf("Enter the elements of the matrix a\n");
    for (i=0;i<m;i++)
    {
               scanf("%d",&a[i]);
           }
    printf("print matrix a\n");
    for (i=0;i<m;i++)
    {
    printf("%d\t",a[i]);
    }

    getch();
                              Output
                     

Example of two dimensional array(transpose of matrix) (code+output)
#include <stdio.h>
#include<conio.h>
void main()
{
   Clrscr ();
    int a[3][3];
    int i, j, m, n;
    printf("Enter the order of the matrix \n");
    scanf("%d %d", &m, &n);
    printf("Enter the coefficent of the matrix\n");
    for (i=0;i<m;i++)
    {
        for (j=0;j<n;j++)
        {
            scanf("%d", &a[i][j]);
 }
     }

    printf("The matrix a \n");
    for (i=0i<m;i++)
    {
        for (j=0;j<n;j++)
        {
            printf(" %d",a[i][j]);
        }
        printf("\n");
    }
    printf("Transpose of matrix a\n");
    for (i=0;i<n;i++)
    {
        for (j=0;j<n;j++)
        {
            printf(" %d",a[j][i]);
        }
        printf("\n");
    }
     getch();
}
                                                      Output
                     

This program solved by Ms. Aakash Aggarwal (Guided by SHABANA IDRISI) .NET Trainer at Vtech Academy of Computers

Wednesday, 12 July 2017

How to create password in c language

How to make password program in c

#include<stdio.h>
#include<conio.h>
#include<string.h>
int password(char max[])
{
char ch[100];
int i=0;
printf("\nenter the password :");
while(1)
{
int m=getch();
if(m==13)
{
break;
}
else if(m==8)
{
if(i==0)
{
}
else
{
printf("\b");
printf(" ");
printf("\b");
i--;

}

}
else
{
ch[i]=m;
i++;
printf("*");

}
}
ch[i]=NULL;
int m=strcmp(ch,max);
return m;

}
int admin(char max1[])
{

char ch1[100];
int j=0;
printf("\nenter the user name :");

while(1)
{

int n=getch();
if(n==13)
{
break;
}
else if(n==8)
{
if(j==0)
{
}
else
{
printf("\b");
printf(" ");
printf("\b");

j--;
}

}
else
{

ch1[j]=n;
j++;
printf("*");

}
}
ch1[j]=NULL;
int n=strcmp(ch1,max1);
return n;
}
void main()
{
clrscr();
char ch[]="vtech";
char ch1[]="vtech";
                 // int m=password(ch);
  int n=admin(ch1);
int m=password(ch);

clrscr();
printf("\n");
if(m==0 && n==0)
{
printf("admin name is correct\n");
printf("password is correct\n");
}
else
{
printf("admin name is incorrect\n");
printf("password is incorrect\n");
}
  getch();
}

This program solved by Ms Aakriti Srivastav (Presented by Jitendra Kumar JAVA Trainer at Vtech Academy of Computers)- C | C++ | DS | JAVA | Android | Python & Oracle