Sie sind auf Seite 1von 42

A PROJECT REPORT ON

“HOTEL MANAGEMENT SYSTEM”

Submitted to
PANJAB UNIVERSITY, CHANDIGARH.

In partial fulfillment for the award of the degree


of
BACHELORS OF COMPUTER APPLICATIONS

IN
FACUTLY OF SCIENCE
PANJAB UNIVERSITY, CHANDIGARH.

Under the Supervision of: Submitted By:


Lect. Gaurav Jindal Sunil Kumar (811)
Department of B.C.A.. Farhan (820)
Post Graduate Govt. College, Randeep Kaur (828)
Sector-46 B, Chandigarh.

FACUTLY OF SCIENCE
PANJAB UNIVERSITY, CHANDIGARH.
(2010-2011)
PREFACE

This project is submitted in partial fulfillment of the requirements for the


award of the degree of

“Bachelor of Computer Application”

The project report is prepared for the project completed during the course
of final year undertaken at Post Graduate Government College, Sector 46,
Chandigarh as a part of the BCA curriculum as prescribed by Panjab University,
Chandigarh.

The project report includes some background information about the


management software of “Hotel Management System” which was assigned
during the course of BCA.

The project report includes detailed information about the software


developed of the Management of Hotel record of THE TAJ. Its includes detailed
information about every module contained in this project.

The project report explains the various strategies and the techniques that
are used the course of the development of the software.

Apart from the mentioning the software development life cycle, the project
report contains the hardware/software requirements for it as well as some
running samples of the product as screenshots as well as some basic
introduction of the languages used for the development of purposaed software.

“Hotel Management System” is Command line interface. With the help of


this project the management will be able to keep the record of rooms and as well
as customers and this will surely reduce the overheads of the management to
great extent.

This software provide user friendly interface and for the Convenience of
the user there is also a provision for help (Introudcation) menu, form which a ser
can get the required information about how to manipulate various objects in the
software.
ACKNOWLEDGEMENT

A formal statement of acknowledgement is hardly sufficient to express our


gratitude towards the personalities who have helped us to undertake and to carry
on this project. We hereby convey our thankfulness and obligations to all those
who are providing us valuable help, support and guidance to carry out this
project.

First and foremost, we express our gratitude and thanks towards Mr.
Gaurav Jindal (Lecturer – BCA Department). His keen interest and
encouragement has been of immense help to us. He gave us unending support
and helped us in numerous ways from the stage when the idea of the project was
conceived. He was always there to listen and to give advice. He is responsible
for involving us in this project. He taught me how to ask questions and express
my ideas. He showed me different ways to approach a research problem and the
need to be persistent to accomplish my goals. He has taken pain to go through
the project and make necessary correction as and when needed.

We express our thanks to our principal Mrs. Sham Latta for extending his
support. We are also thankful to other faculty members of BCA Department for
their valuable time and kind suggestion regarding this project.

We thank the almighty God for blessing us with new challenges in life and
giving us enough strength to meet those challenges. We owe everything to our
parents who worked very hard to provide us everything in life.

Finally we are indebted to our friends who showed tolerance and maturity
when we were preoccupied with the composition of the project cannot be
expressed in words.
Post Graduate Government College, Sector 46

PANJAB UNIVERSITY, CHANDIGARH

CERTIFICATE

TO WHOM SO EVER IT MAY CONCERN

This is to certify that Sunil Kumar (811), Farhan (820), Randeep

Kaur (828) pursuing Bachelor Of Computer Application, at Post Graduate

Government College, Sector 46, Chandigarh, undertook a project entitled

software on “Hotel Management System” which is a record of bonafide work

carried out by them under my provision. In my knowledge, this work has not been

submitted, either in part or in full, to any other university or institute for the award

of degree.

Mr. Gaurav Jindal

(Project Guide)

Post Graduate Government College,

Sector-46, Chandigarh
DECLARATION

We all the members of the group here by, declare that the project report on
“Hotel Management System” is the result of original work done by us and to the best of
our knowledge a similar work has not been submitted earlier to the Panjab University or
any other institution, for fulfillment of the requirements of a course of study.

We have undergone all the necessary requirement and formalities with the
college that are necessary for the submission of this project report

This project report is submitted for partial fulfillment of all awards of the degree of
Bachelor of Computer Application of Panjab University, Chandigarh.

Sunil Kumar (811)


Farhan (820)
Randeep Kaur (828)

Above statement by the candidate is true to the best of my knowledge

(Mr.Gaurav Jindal)
INDEX

“HOTEL MANAGEMENT SYSTEM”

Sr. No. Topics Signature

01 Introduction to the project

02 REVIEW

03 Objective

04 Software and Hardware requirement of project

05 Software Development Life Cycle(SDLC)

06 Data Dictionary(DD)

07 Data Flow Diagram(DFD)

08 Software Testing

09 Introduction to C language

10 Introduction to Graphics

11 Snapshots of Project Windows

12 Bibliography
INTRODUCTION of the PROJECT

This is a Project work undertaken in context of partial fulfillment of BCA. I


tried my best to make the complicated process of Hotel Management System as
simple as possible using C/C++. I tried to design the software in such a way that
user may not have any difficulty in using this package & further expansion is
possible without much effort. Even though I cannot claim that this work will be
entirely exhaustive, the main purpose of my exercise will be perform each
Employees activity in computerized way rather than manually which is time
consuming. I am confident that this software package will be readily used by non-
programming personal avoiding human handled chance of error. This project is
used by Administrator or receptionist. Administrator & receptionist can maintain
daily updates in the hotel records. The main aim of the entire activity is to
automate the process of day to day activities of Hotel like Room activities,
Admission of a New Customer, Assign a room according to customers demand,
checkout of a computer and releasing the room and finally compute the bill etc.
The limited time and resources will restrict us to incorporate, in this project, only
the main activities that are performed in a HOTEL Management System, but
utmost care was taken to make the system efficient and user friendly. “HOTEL
Management System” will be designed to computerized the

Following functions that are performed by the system:

 Introduction

 Inquiry

 Check-in

 Check-out

 Room Status
 Report
 Generates Database
 About us
 Exit
REVIEW

During the past several decades’ personnel function has been transformed
from a relatively obscure record keeping staff too central and top level
management function. There are many factors that have influenced this
transformation like technological advances, professionalism, and general
recognition of human beings as most important resources.

 This project intends to introduce more user friendliness in the various


activities such as record updating, maintenance, and searching.

 The searching of record will be made quite simple as all the details of the
customers can be obtained by simply keying in the identification of that
customer.

 Similarly, record maintenance and updating will also be accomplished by


using the identification of the customer with all the details being
automatically generated. These details are also will have been promptly
automatically updated in the master file thus keeping the record absolutely
up-to-date.

 The entire information has maintained in the database or Files and


whoever wants to retrieve can retrieve.

 The basic motto behind this project are following:

1. It is fast, efficient and reliable

2. Avoids data redundancy and inconsistency

3. Very user-friendly

4. Easy accessibility of data

5. Number of personnel required is considerably less


OBJECTIVE

The basic objective of HOTEL MANAGEMENT SYSTEM is to generalize


and simplify the monthly or day to day activities of Hotel like Room activities,
Check in of New Customer, Check out of customer, assigning a room according
to customer requirement, and finally compute the bill h has to be performed
repeatedly on regular basis. To provide efficient, fast, reliable and user-friendly
system is the basic motto behind this project are following:

1. No Paper Work Required,


2. Time Efficient,
3. Cost Efficient,
4. Automatic data validation,
5. User friendly environment,
6. Data security and reliability,
7. Fast data insertion & retrieval,
8. Easy performance check.

The main objective of the entire activity is to automate the process of day to day
activities of Hotel like:

1. Room activities,

2. Admission of a New Customer,

3. Assign a room according to customers demand,

4. Checkout of a customer and releasing the room,

5. Generate the Bill Automatically,

6. Room Record & Customer Record,

7. Room Details
System Implementation

 Software Requirements:
The minimum software requirements for this project are:

 Operating system:
♦ Window XP/98/2000
♦ Dos
 Software:
♦ Turbo C3 .0/4.5

 Hardware Requirements:

 The minimum hardware requirements are:

 64MB RAM prestige


• 1.5GHz processor speed.
SDLC: SOFTWARE DEVELOPMENT LIFE CYCLE

The Systems Development Life Cycle (SDLC) is a conceptual model used in


Project Management that describes the stages involved in an information system
development project from an initial feasibility study through maintenance of the
completed application. Various SDLC methodologies have been developed to
guide the processes involved including the waterfall model (the original SDLC
method), rapid application development (RAD), Joint Application Development
(JAD), the fountain model and the spiral model. Mostly, several models are
combined into some sort of hybrid methodology. Documentation is crucial
regardless of the type of model chosen or devised for any application, and is
usually done in parallel with the development process. Some methods work
better for specific types of projects, but in the final analysis, the most important
factor for the success of a project may be how closely particular plan was
followed.

The image below is the classic Waterfall model methodology, which is the first
SDLC method and it describes the various phases involved in development.

 Feasibility

A feasibility study was an evaluation of the proposal designed to determine the


difficulty in carrying out a designed task. Generally, a feasibility study precedes
technical development and project implementation. In other words, a feasibility
study is an evaluation or analysis of the potential impact of a proposed project.

 Technology and System Feasibility

The assessment is based on an outline design of system requirements in terms


of Input, Processes, Output, Fields, Programs, and Procedures. This can be
quantified in terms of volumes of data, trends, frequency of updating etc. in order
to estimate whether the new system will perform adequately or not.
Technological feasibility is carried out to determine whether the company has the
capability, in terms of software, hardware, personnel and expertise, to handle the
completion of the Project.

 Economic Feasibility

Economic analysis is the most frequently used method of evaluating the


effectiveness of a new system. More commonly known as cost/benefit analysis,
the procedure is to determine the benefits and savings that are expected from a
candidate system and compare them with costs. If benefits outweigh costs, then
the decision is made to design and implement the system. An entrepreneur must
accurately weigh the cost versus benefits before taking an action.

 Requirement Analysis

Requirements analysis is the process of understanding the customer needs and


expectations from a proposed system or application and is a well-defined stage
in the Software Development Life Cycle model. The Software Requirement
Analysis Process covers the complex task of eliciting and documenting the
requirements of all these users, modeling and analyzing these requirements and
documenting them as a basis for system design. Requirements are a description
of how a system should behave or a description of system properties or
attributes. It can alternatively be a statement of ‘what’ an application is expected
to do.

Analysis gathers the requirements for the system. This stage includes a detailed
study of the business needs of the organization. Options for changing the
business process may be considered. Design focuses on high level design like,
what programs are needed and how are they going to interact, low-level design
(how the individual programs are going to work), interface design (what are the
interfaces going to look like) and data design (what data will be required). During
these phases, the software’s overall structure is defined. Analysis and Design
are very crucial in the whole development cycle. Any glitch in the design phase
could be very expensive to solve in the later stage of the software development.
Much care is taken during this phase. The logical system of the product is
developed in this phase.

 Software Design

Software design is a process of problem-solving and planning for a software


solution. After the purpose and specifications of software are determined,
software developers will design or employ designers to develop a plan for a
solution. It includes low-level component and algorithm implementation issues
as well as the architectural view.

When design stages complete, phases design will take over which include
architectural design, abstract specification, interface design, component design,
data structure design and algorithm design. The design process may be
modeled as a directed graph made up of entities with attributes which participate
in relationship.
 Implementation

Implementation is the carrying out, execution or practice of a plan, a method, or


any design for doing something. As such, implementation is the action that must
follow any preliminary thinking in order for something to actually happen. In an
information technology context, implementation encompasses all the process
involved in getting new software or hardware operating properly in its
environment, including installation, configuration, running, testing and making
necessary changes.

In this phase the designs are translated into code. Computer programs are
written using a conventional programming language or an application generator.
Programming tools like Compilers, Interpreters, Debuggers are used to generate
the code. Different high level programming languages like C, C++, Pascal, Java
are used for coding. With respect to the type of application, the right
programming language is chosen.

 Testing

Software Testing is the process of executing a program or system with the intent
of finding errors. It involves any activity aimed at evaluating an attribute or
capability of a program or system and determining that it meets its required
results. Software is not unlike other physical processes where inputs are
received and outputs are produced. Where software differs is in the manner in
which it fails, Most physical system fail in a fixed (and reasonably small) set of
ways. By contrast, software can fail in many ways. Detecting all of he different
failure modes for software is generally infeasible. Unlike most physical systems,
most of the defects in the software are design errors, not manufacturing defects.
Software does not suffer from corrosion, wear-and-tear – generally it will not
change until upgrades, or until obsolescence. So once the software is shipped,
the design defects – or bugs – will be buried and in remain latent until activation.

Normally programs are written as a series of individual modules, these subjects


to separate and detailed test. The system is then tested as a whole. The
separate modules are brought together and tested as a complete system.
 Black-box testing

The black-box approach is a testing method in which test data are derived from
the specified functional requirements without regard to the final program
structure. It is also termed data-driven, input/output driven or requirements-
based testing. Because only the functionality of the software module is of
concern, black-box testing also mainly refers to functional testing – a testing
method emphasized on executing the functions and examination of their input
and output data. The tester treats the software under test as a black box – only
the inputs, outputs and specification are visible, and the functionality is
determined by observing the outputs to corresponding inputs.

 White-box testing

Contrary to black-box testing, software is viewed as a white-box or glass-box in


white-box testing, as the structure and flow of the software under test are visible
to the tester. Testing plans are made according to the details of the software
implementation, such as programming language, logic, and styles. Test cases
are derived from the program structure. White-box testing is also called glass-
box testing, logic-driven testing or design-based testing.

 Maintenance

Maintenance is the modification of a software product after delivery to correct


faults, improve performance, or other product attributes, or to adapt the product
to a new or changing environment. Software maintenance is not like hardware
maintenance, which is the return of the item to its original state. Software
maintenance involves moving an item away from its original state. It
encompasses all activities associated with the process of changing software.

Inevitably the system will need maintenance. Software will definitely undergo
change once it is delivered to the customer. There are many reasons for he
change. Change could happen because of some unexpected input values into
the system. In addition, the changes in the system could directly affect the
software operations. The software should be developed to accommodate
changes that could happen during the post implementation period.
DATA DICTIONARY

A data dictionary contains a list of all files in the database, the number of records
in each file, and the names and types of each field. Most database management
systems keep the data dictionary hidden from users to prevent them from
accidentally destroying its contents.
Dictionary of the data used in the analysis of the structure and design of
information systems also is a catalog that describes more detail about the flow
diagram that includes processes, data flow and data store. Data dictionary is
created and used both on the stage and in the analysis stage, the design system.
In the analysis stage, data dictionary is used as means of communication
between the systems analyst with the user of the data that flows on the system
and the information required by the system. At analysis, the dictionary is used as
the means of communication between the systems analyst with the user. At the
system design, data dictionary is used to design input, reports and databases.
Data dictionary should include the following:

 Data Flow:

Data flow from which the data shows the flow and where the data will go.
Description of data flow should be noted in this data dictionary to make it easier
to find in the data flow diagram(DFD).

 Name of Data Flow:

Because data dictionary is based on a data flow that flows in the data flow
diagram, the flow of data should be noted in the dictionary, so that those who
read the DFD and require further explanation about a particular data flow
diagram can browse easily in the data dictionary.

 Types Of Data:

Data flow can flow from the flow of a process to other process. Data which is
usually in the form of reports and documents of printing machines. Thus the
shape of data flow can be a basic document or form, the computer prints, the
documents, the report is printed, the display screen on the monitor, variables,
parameters and field-field. Forms of data such as this should be noted in the data
dictionary.
 Data structure:
Shows the data structure of data flow is recorded in the data dictionary that
consists of items of data. A data dictionary is invaluable for documentation
purposes, for keeping control information on corporate data, for ensuring
consistency of elements between organizational systems, and for the use of in
developing databases.

 Alias:
Alias or name of data must also be written. Alias is needed because the data
have the same name that is different to other people or departments.

 Volume:
Volume that needs to be noted in the data dictionary is the volume average and
peak volume of data flow. Volume shows the average number of data flow that
flows in one period certain volume while the volume in peak indicates the most.

 Period:
This period indicates when the occurrence of data flow. Period should be noted
in the data because the campus can be used to identify when the input data must
be entered into the system, when the program should be done and when the
report should be produced.
 Description:
To further clarify, the meaning if data flow is recorded in the data dictionary, then
explanation can be charged with the particulars of the data flow.
The components of the Data Dictionary
The Data dictionary defines the basic organization of a database and collects
together detailed information about database system components. This can
include:
• Data element definitions (tables, fields, key fields, primary keys,
relationships etc.)
• Program elements(stored procedures, scripts etc) used by the database to
move data about or to manipulate it in some way
• Records (number of – not the actual records themselves)
• System parameters
• System information
• Files and other system components
• User information
• Entity relationship diagrams
• Database schema
Database security model
DATA FLOW DIAGRAM

A Data Flow Diagram (DFD) is a significant modeling technique for analyzing and
constructing information processes. DFD literally means an illustration that
explains the course or movement of information in a process. DFD illustrates this
flow of information in a process based on the inputs and outputs. A DFD can be
referred to as a Process Model.
Additionally, a DFD can be utilized to visualize data processing or a structured
design. A DFD illustrates technical or business process with the help of the
external data stored, the data flowing from a process to another and the results.
A designer usually draws a context-level DFD showing the relationship between
the entities inside and outside of a system as one single step. This basic DFD
can be then disintegrated to a lower level diagram demonstrating smaller steps
exhibiting details of the system that is being modeled. Numerous levels may be
required to explain a complicated system.

Data Flow Diagram Symbols

 External Entity

External entity

This symbol is used to describe the origin and destination data. External entity
can be a person, group of people, organizations, departments in the
organization, or the same company, but in system beyond the current model is
made. External entity may also include departments, divisions or outside the
systems that communicate with the system that is currently being developed.

 Data Flow

Data Flow
This symbol is used to describe the flow of data that are running./ Data flow
direction is indicated with arrows and lines give the name on the flow of data
flow. Data flow between the process flow, data storage and data flow indicates
that the form, of data input to the system. Guidelines of the name: (1)Name of
the data flow that consists of some words associated with the flow line speed. (2)
Name of the data flow that consists of some words associated with the flow line
speed.(3)Data flow that consists of several elements can be expressed with the
group elements.(4)Avoid using the word ‘data’ and ‘information’ to give a name to
the data flow.(5)The extent possible the complete data is written.
 Process
1 Input & 1 Output 1 Input & Banyak Output

Banyak input & 1 Output Banyak input & banyak Output

This symbol is also called the bubble, used for processing or data transformation,
guidelines of the process: (1)Name of the process consists of a verb and noun,
which reflects the function of the process (2) Do not use the process as part of
the name of a bubble (3) There may be some process that has the same name.
(4) The process must be given a number. Order number wherever possible to
follow the flow of the process or sequence, but the sequence number does not
mean that the absolute is a process in chronological order. There are four
possibilities that can occur in the process in relation with the input and output:

 Data Store

Data Store

This symbol is used to describe the data flow is saved or achieved. Data store is
usually associated with the storages, such as file or database associated with the
storage computerization, such as a diskette file, files, hard disk, magnetic tape
files. Data store is also related to the storage manually, such as books address,
file folder, and agenda. A data store associated with the data flow only on the
components process, not with the other components DFD.
Data Flow is a network diagram illustrating a computerized system, manual or a
combination of both, and representation in the form of a set of structured system
components that are interconnected in accordance with the rules play.
Advantage of DFD is possible to describe the system from the highest level.
SOFTWARE TESTING

It is the process used to help identify the correctness, completeness, security,


and quality of developed computer software. Testing is a process of technical
investigation, performed on behalf of stakeholders, that is intended to reveal
quality-related information about the product with respect to the context in which
it is intended to operate. This includes, but is not limited to, the process of
executing a program or application with the intent of finding errors. Quality is not
an absolute; it is value to some person. With that in mind, testing can never
completely establish the correctness of arbitrary computer software; testing
furnishes a criticism or comparison that compares the state and behavior of the
product against a specification. An important point is that software testing should
be distinguished from the spate discipline of Software Quality Assurance (SQA)
which encompasses all business process areas, not just testing.

Software testing life cycle

Software testing life cycle identifies what test activities to carry out and when
(what is the best time) to accomplish those test activities. Even though testing
differs between organizations, there is a testing life cycle.

Software Testing Life Cycle consists of six (generic) phases:

Test Planning, Test Analysis, Test Design, Construction and verification, Testing
Cycles, Final Testing and Implementation and Post Implementation. Software
testing has its own life cycle that intersects with every stage of the SDLC. The
basic requirements in software testing life cycle is to control/deal with software
testing – Manual, Automated and Performance.

Test Planning

This is the phase where Project Manager has to decide what things need to be
tested, do I have the appropriate budget etc. Naturally proper planning at this
stage would greatly reduce the risk of low qualify software. This planning will be
an on going process with no end point.
Activities at this state would include preparation of high level test plan –
(according to IEEE test plan template. The Software Test Plan (STP) is
designed to prescribe the scope, approach, resources and schedule of all testing
activities. The plan must identify the items to be tested, the features to be tested,
the types of testing to be performed, the personnel responsible for testing, the
resources and schedule required to complete testing, and the risks associated
with the plan). Almost all of the activities done during this stage are included in
this software test plan and revolve around a test plan.

Test Analysis

Once test plan is made and decided upon, next step is to develop little more into
the project and decide what types of testing should be carried out at different
stages of DLC, do we need or plan to automate, if yes then when the appropriate
time to automate is, what type of specific documentation I need for testing.

Proper and regular meeting should be held between testing teams, project
managers, and development teams, Business Analysis to check the progress of
things which will give a fair idea of the movement of the project and ensure the
completeness of the test plan created in the planning phase, which will further
help in enhancing the right testing strategy created earlier. We will start creating
test case formats and test cases itself. In this stage we need to develop
functional validation matrix based on Business Requirements to ensure that all
system requirements are covered by one or more test cases, identify which test
cases to automate, begin review of documentation i.e. Function Design,
Business Requirements, Product Specifications, Product Externals etc. We also
have to define areas for Stress and Performance testing.

Test Design

Test plan and cases which were developed in the analysis phase are revised.
Functional validation matrix is also revised and finalized. In this stage risk
assessment criteria is developed. If you have thought of automation then yuou
have to select which test cases to automate and begin writing scripts for them.
Test data is prepared. Standards for unit testing and pass / fail criteria are
defined here. Schedule for testing is revised (if necessary) & finalized and test
environment prepared.
Construction and Verification

In this phase we have to complete all the test plans, test cases, complete the
scripting of the automated test cases, Stress and Performance testing plans
needs to be completed. We have to support the development team in their unit
testing phase./ And obviously bug reporting would be done as when the bugs
are found. Integration tests are performed and errors (if any) are reported.

Testing Cycles

In this phase we have to complete testing cycles until test cases are executed
without errors or a predefined condition is reached. Run test cases -->Report
Bugs -->revise test cases (if needed) -->add new test cases(if needed) -->bug
fixing -->retesting (test cycle2,test ycle3….).

Final Testing Implementation

In this we have to execute remaining stress and performance test cases,


documentation for testing is completed / updated, provide and complete different
matrices for testing. Acceptance, load and recovery testing will also be
conducted and the application needs to be verified under production conditions.

Post Implementation

In this phase, the testing process is evaluated and lessons learnt from and
testing process are documented. Line of attack to prevent similar problems in
future project is indentified. Create plans to improve the processes. The
recording of new errors and enhancements is an ongoing process. Clearing up
of test environment is done and test machines are restored to base lines in this
stage.
‘C’ LANGUAGE

As a programming language, C is rather like Pascal or Fortran. Values are


stored in variables Programs are structured by defining and calling functions.
Program flow is controlled using loops, if statements and function calls. Input and
output can be directed to the terminal or to files. Related data can be stored
together in arrays or structures.

Of the three languages, C allows the most precise control of input and output. C
is also rather more terse than Fortran or Pascal. This can result in short efficient
programs, where the programmer has made wise use of C’s range of powerful
operators. It also allows the programmer to produce programs which are
impossible to understand.

Programmers who are familiar with the use of pointers (or indirect addressing, to
use the correct term) will welcome the ease of use compared with some other
languages. Undisciplined use of pointers can lead to errors which are very hard
to trace. This course only deals with the simplest application of pointers.

It is hoped that newcomers will find C a useful and friendly language. Care must
be taken in using C. Many of the extra facilities which it offers can lead to extra
types of programming error. You will have to learn to deal with these to
successfully make the transition to being a C Programmer.

Variables

In C, a variable must be declared before it can be used. Variables can be


declared at the start of any block of code, but most are found at the start of each
function. Most local variables are created when the function is called, and are
destroyed on return from the function.

A declaration begins with the type, followed by the name of one or more
variables. For example,

Int high, low, results [20];

C provides a wide range of types. The most common are

Int An Integer
Float A floating point (real) number
Char A single byte of memory, enough to hold a character
Constants
A C constant is usually just the written version of a number, For example 1, 0,
5.73, 12.5e9. We can specify our constants in octal or hexadecimal, or force
them to be treated as long integers.

• Octal constants are written with a leading zero – 015.

• Hexadecimal constants are written with a leading 0x – ox lae.

• Long constants are written with a trailing L – 890

Arrays

An array is a collection of variables of the same type. Individual array elements


are identified by an integer index. In C the index begins at zero and is always
written inside square brackets.

We have already met single dimensioned arrays which are declared like this

Int results [20];

Arrays can have more dimensions, in which case they might be declared as

Int results_2d[20[[5]

Int results_3d[20][5][3];

Each index has its own set of square brackets.

Where an array is declared in the main function it will usually have details of
dimensions included. It is possible to use another type called a pointer in place
of an array. This means that dimensions are not fixed immediately, but space
can be allocated as required. This is an advance technique which is only
required in certain specialized programs.

Expressions and Operators

One reason for the power of C is its wide range of useful operators. An operator
is a function which is applied to values to give a result. You should be familiar
with operators such as =,-,/.

Arithmetic operators are the most common. Other operators are used for
comparison of values, combination of logical states, and manipulation of
individual binary digits. The binary operators are rather low level for so are not
covered here.

Assignment Statement

The easiest example of an expression is in the assignment. An expression is


evaluated, and the result is saved in a variable. A simple example might look like

Y = (m * x) = c

This assignment will save the value of the expression in variable y.

Arithmetic Operators

Here are the most common arithmetic operators.

+ Addition

- Subtraction

- *Multiplication

/ Division

*,/and % a will be performed before + or – in any expression. Brackets can be


used to force a different order of evaluation to this. Where division is performed
between two integers, the result will be an integer, with remainder discarded.
Modulo reduction is only meaningful between integers. If a program s ever
required to divide a number by zero, this will cause an error, usually causing the
program to crash.

Type Conversion

You ca mix the types of values in your arithmetic expressions. Char types will be
treated as int. Otherwise where types of different size are involved, the result will
usually be of the larger size, so a float and a double would produce a double
result. Where integer and real types meet, the result will be a double.

There is usually no trouble in assigning a value to a variable of different type.


The value will be preserved as expected except where;

• The variable is too small to hold the value. In this case it will be corrupted
(this is bad).
• The variable is an integer type and is being assigned a real value. The
value is rounded down. This is often done deliberately by the programmer.

Comparison

C has no special type to represent logical or Boolean values. It improvises by


using any of the integral type char, int, short, long, unsigned, with a value of o
representing false and any other value representing true. It is rate for logical
values to be stored in variables. They are usually generate as required by
comparing two numeric values. This is where the comparison operators are
used, they compare two numeric values and produce a logical result.

C Notation Meaning

== Equal to

> Greater than

< Less than

>= Greater than or equal to

<= Less than or equal to

!= Not equal to

Logical Connectors

These are the usual And, Or and Not operators.

Symbol Meaning

&& AND

|| OR

! NOT

They are frequently used to combine relational operators, for example

X<20 && x>=10

Control Statements
A Program consists of a number of statements which are usually executed in
sequence. Programs can be much more powerful if we can control the order in
which statements are run.

Statements fall into three general types;

• Assignment, where values, usually the results of calculations, are stored in


variables

• Input / Output, data is read in or printed out

• Control, the program makes a decision about what to do next.

This is used to decide whether to do something at a special point, or to decide


between two courses of action.

The following test decides whether a student has passed an exam with a pass
mark of 45

If (result>=45)

Printf (“Pass\n”);

Else

Printf (“fail\n”);

The switch Statement

This is another form of the multi way decision. It is well structured, but can only
be used in certain cases where;

• Only one variable is tested, all branches must depend on the value of that
variable. The variable must be an integral type. (int, long, short or char).

• Each possible value of the variable can control a single branch. A final,
catch all, default branch may optionally be used to trap all unspecified cases.

Loops

C gives you a choice of three types of loop, while, do while and for.
• The while loop keeps repeating an action until an associated test returns
false. This is useful where the programmer does not know in advance how many
times the loop will be traversed.

• The do while loops is similar, but the test occurs after the loop body is
executed. This ensures that the loop body is run at lease once.

• The for loop is frequently used, usually where the loop will be traversed a
fixed number of times. It is very flexible, and novice programmers should take
care not to abuse the power it offers.

The while Loop

The while loop repeats a statement until the test at the top proves false.

As an example, here is a function to return the length of a string. Remember that


the string is represented as an array of characters terminated by a null
character’\o’.

int string_length(char string[])

int i=0;

While (string[i] !=’\0’)

i++;

return(i);

The do while Loop

This is very similar to the while loop except that the test occurs at the end of the
loop body. This guarantees that the loop is executed at least once continuing.
Such a setup is frequently used where data is to be read. The test then verifies
the data, and loops back to read again if it was unacceptable.

Do

Printf(“Enter 1 for YES, 0 for NO:”);


Scanf(“%d”, &input_value);

While(input_value !=1 && input_value!=0)

The for Loop

The for loop works well where the number of iterations of the loop is known
before the loop is entered. The head of the loop consists of three parts
separated by semicolons.

float average(float array[], int count)

Float total=0.0;

int I;

for(i=0; i<count; i++)

Total += array[i];

return(total / count);

The break statement

We have already met break in the discussion of the switch statement. It is used
to exit from a loop or a switch, control passing to the first statement beyond the
loop or a switch.

With loops, break can be used to force an early exit from the loop, or to
implement a loop with a test to exit in the middle of the loop body. A break within
a loop should always be protected within an if statement which provides the test
to control the exit condition.

The continue Statement


This is similar to break but is encountered less frequently. It only works within
loops where its effect is to force an immediate jump to the loop control statement.

• In a while loop, jump to the test statement

• In a do while loop, jump to the test statement.

• In a for loop, jump to the test, and perform the iteration.

The goto Statement

C has a goto statement which permits unstructured jumps to be made. Its use is
not recommended, so we’ll not teach it here. Consult your textbook for details of
its use.

Functions in C

Almost all programming language have some equivalent of the function. You
may have met them under the alternative names subroutine or proceduce.

Some languages distinguish between functions which return variables and those
which don’t . C assumes that every function will return a value. If the
programmer wants a return value, this is achieved using the return statement. If
no return values required, none should be used when calling the function.

Here s a function which raised a double to the power of an unsigned, and returns
the result.

double power(double val, unsigned pow)

double ret_val = 1.0;

unsigned I;

for(i=0; i<=pow; i++)

ret_val *=val;

return(ret_val);
}

Pointers in C

Pointers are not exclusive to functions, but this seems a good place to introduce
the pointer type.

Imagine that we have an int called i. Its address could be represented by a


symbol &. If the pointer is to be stored as a variable, it should be stored like this.

Int *pi=&i;

int * is the notation for a pointer to an int. & is the operator which returns the
address of its argument. When it s used, as in &I we say it is referencing i.

Recursive Functions

A recursive function is one which calls itself. This is another complicated idea
which you are unlikely to meet frequently. We shall provide some examples to
illustrate recursive functions.

Recursive functions are useful in evaluating certain type of mathematical


function. You may also encounter certain dynamic data structures such as linked
lists or binary trees. Recursion is a very useful way of creating and accessing
these structures.

Structures in C

A structure is a collection of variables under a single name. These variables an


be of different types, and each has a name which is used to select it from the
structure. A structure is a convenient way of grouping several pieces of related
information together.
GRAPHICS
The term graphic design can refer to a number of artistic and professional
disciplines which focus on visual communication and presentation. Graphic
design often refers to both the process by which the communication is created
and the products which are generated. Common uses of graphic design include
magazines, advertisement and product packaging. For example, a product
package might include a logo or other artwork, organized text and pure designed
elements such as shapes and color which unify the piece.

Computer graphics are graphics created using computers and, more


generally the representation and manipulation of image data by a computer.

The development of computer graphics, or simply referred to as CG, has


made computer easier to interact with, and getter for understanding and
interpreting many type of data. Developments in computer graphics have had a
profound impact on man types of media and have revolutionized the animation
and video game industry.

PIXEL

Short for Picture Element, a pixel is a single point in a graphic image. Graphics
monitors display picture by dividing the display screen into thousands of pixels,
arranged in rows and columns. The pixels are so close together that they appear
connected.

The number of bit used to represent each pixel determines how many colors or
shades of gray can be displayed. For example, in 8-bit color mode, the color
monitor uses 8 bits for each pixel, making it possible to display 2 to the 8 th power
(2546) different colors or shades of grey.

On color monitors, each pixel is actually composed of three dots – a red, a blue,
a green one. Ideally, the three dots should all coverage at the same point, but all
monitor have some convergence error that can make color pixels appear fuzzy.

RESOLUTION

Refers to the sharpness and clarity of an image. The term is most often
used to describe monitors, printers, and bit-mapped graphic images. In the case
of dot- matrix and laser printers, the resolution indicates the number of dots per
inch. For example, a 300-dpi (dots per inch) printer is the one that is capable of
printing 300 distinct dots in the line one inch long. These mean it can print 90,000
dots per square inch.

For graphics monitors, the screen resolution signifies the number of dot (pixel) on
the entire screen. For example, a 640-by-480 pixel screen is capable of
displaying 640 distinct dots on each of 480 lines, or about 300,000 pixels. This
translates into different dpi measurement depending on the size of screen. For
example, a15-inch VGA monitor (640X480) displays about 50 dots per inch.

Function initgraph

This function is used to load the graphic driver and initialize the graphics system.
For every function, that uses graphics mode, graphics mode must be initialized
before using that function.

void far initgraph (int far *driver, int far *mode, char far * path)

Path determine that path to the specified graphics driver

Function detect graph.

Detect graph function determines the graphics hardware in the system, if the
function find a graphic adaptor then it returns the highest graphics mode that the
adaptor supports.

Void far detectgraph (int far *driver, int far *mode)

Function cleardevice

This function clears the graphics screen content and returns the control to the location
(0, 0).

Void far cleardevice(void)

Function closegraph

This function shut down the graphics modes and returns to the position it was
before the initgraph function was called closegraph. Function releases all the
resources occupied by the graphic system like memory, fonts, drivers etc.
SNAPSHOTS

Loading of the Project


Welcome Screen

Date Screen
Main Screen

Introduction Menu
CHECK IN PROCESS
CHECK OUT PROCESS
ROOM STATUS
REPORT

GENERATE DATABASE
ABOUT US
BIBLOGRAPHY

PERSONS:

Mr.GAURAV JINDAL (Lecturer of bca dept.)

Mr.Mohit Sanan (Lecturer of bca dept.)

Ms. Vandana (Lecturer of bca dept.)

Mrs.Jatinder kaur (Lecturer of bca dept.)

STUDIED MATERIALS:

“project on c language” by Yashvant kanetkar

“let us c” by Yashvant kanetkar

“Graphic under c” by Yashvant kanetkar

“Programming in c language” by Yashvant kanetkar

Website VISITED:

WWW.W3SCHOOLS.COM

WWW.CPROGRAMMING.COM

WWW.CODEGRAVITY.COM

WWW.PROGRAMMINGTUTRIALS.COM

WWW.SECURECODING.CERT.ORG

Das könnte Ihnen auch gefallen