65
 On Restaurant Management System Submitted   T o : Mr.Pr  i ya n k J a i n S i g n a t u r e o f T  eache  r Submitted   B  y : F a i z K h a n  Ar i  f K h a n Y  a w a r H ussai  n S ig n a t u r e o f  Stude  n t  

RESTAURENT

Embed Size (px)

Citation preview

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 1/65

 

On Restaurant Management System

Submitted  To :Mr.Pr iya nk J ai n 

Sig n atu r e  of T  eache r 

Submitted  B  y  :F aiz  K ha n 

 Ar i  f K ha n Y  awa r H ussai  n 

Sig n atu r e  of  Stude n t  

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 2/65

INDEX 

B.C.A.

Contents Page No.

1.  Introduction of Project

2.  S/W.,H//W. Requirement

3.  Objective.

4.  Project Planning

5.  Coding

6.  Conclusion

7.  Bibliography

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 3/65

Contents of Project File

1.  Front Page

2.  Certificate

3.  Acknowledgement

4.  Preface

5.  Index

Instructions :

1.  Do not use Photocopy

2.  Every student should submit three copy of document file(one

printout and two photocopy)

3.  Every Page must have Page No.

4.  print out copy should be hard Binding & Color of front page

Should be Dark Blue & Font is Black 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 4/65

 

Certificate

This is to certify that Faiz Khan,Arif Khan ,Yawar Hussain who is

student of B.C.A. of this Institution has Successfully completed her Project

on ³Restaurant Management System´ during academic session 2010-

2011

This Project report is submitted in partial fulfillment for award of the

degree of B.C.A. of Barkatullah University Bhopal .

Lecture in charge

Mr.Priyank Jain

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 5/65

 Acknowledgement 

We are grateful to Mr.Priyank Jain entrusting the work of developing a   Report on Restaurant Management System

sincerely thank him for extending his full cooperation and

guidance to us during the making of this project.

We are thankful to all to all faculty members of computer 

department for there cooperation and providing us with the

  basic amenities and an environment which helped us

successfully achieve the completion of our project.

We have put a sincere effort and hope that the project

fulfills their expectations.

Thanking you,

Group Name

F aiz  K ha n  Ar i  f K ha n Y  awa r H ussai  n 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 6/65

 

PPrroo j jeecctt DDeessccrriippttiioonn Introduction about Restaurant Management System

Hotel Management is developed to fulfill the complete requirement of any

Library for its

  Display record according to the customer 

  Customer Entry

   New Customer Information

  Update all Customer¶s records.

  Delete Customer¶s records.

  Display records.

This Project provides facility to manage any department and to

have all the information within a few mouse clicks for the purpose of better 

decision making which provide the organization a competitive edge.

This Project is a complete Graphical User Interface which uses C for storing

and maintaining the database and provide a user friendly environment to the

user. This is a Menu driven system which provides extremely interactive

interface to the user for easy and quick operations.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 7/65

 

SSOOFFTTWWAAR R EE UUSSEEDD ABOUT OPERATING SYSTEM 

WINDOWS 98

In order to understand the application development process, it is

helpful to understand some of the key concepts upon which Visual Basic is

  build because Visual Basic is a windows development language, so some

familiarity with the Windows environment is necessary.

A complete description of the inner working of Windows would require anentire book. A simplified working of the Windows involves three key concepts:-

1  Windows

2  Events

3  Messages

Windows can be thought of simply as a rectangular region withits own boundaries. There are several different types of Windows:

1  An explorer window in Windows 98

2  A document window within our word processing program OR 

3  A dialog box that pops up of remind us of an appointment Icons, Text

 boxes, Option buttons and menu bar all Windows.

The Microsoft Windows O .S manages all of these many

windows by assigning each one a unique ID no. the system continually

monitors each of these windows for sign of activity or events. Events can

occur through user action such as a mouse click or a key press, through programmatic control, or events as a result of another window action.

As can be imagined dealing with all of the possible

combinations of windows, events and messages could be mind-boggling.

Fortunately Visual Basic insulates us from having to deal with all of the low

level messages handling. Many of the messages are handled automatically

 by Visual Basic. This allows us to create powerful application.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 8/65

 

Language Used & Why: 

We are using the Clanguage because of the following advantages.

C: It is convenient for hardware programming.

C: C is an Object Oriented Programming Language (named initially C

with classes), was developed by Bjarne Stroustrup at AT&T Bell

Laboratories in Murray Hall, New Jersy USA, in the early 80¶s. 

y  C has best of two languages, i.e. Simula 67 & C.

y  C is superset of C.

y  The three most important facilities that C adds on to C are Classes,

Function Overloading, &Operator Overloading. These features enable

us to create abstract data type, inherit properties from existing data

type and support polymorphism, thus making C truly Object Oriented.

y  It offers benefits to Program Designer & User. OOPs promises greater 

 programmer productivity, better quality of software & lessmaintenance cost.

y  We can build programs from the standard working modules that

communicate with one another rather than having to start from

scratch. This leads to saving of Development time and Higher 

Productivity.

PLATFORM: MS DOS. / Windows98. 

OPERATIONAL R EQUIR EMENTS

 In this section we will discuss about the functionsused & there respective header files.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 9/65

 

EE--R R  DDIIAAGGR R AAMM 

E-R Modeling is a technique for analysis and logical modeling

of a system¶s data requirements. The relationship between the collection of 

data in a system may be graphically represented using E-R Diagrams. E-R 

Diagrams provides a simplified approach to the structured design of a

system. It helps to determine the data objects in the system, the composition

of each, and the relationship that exists between them.It uses three basic concepts, entities, their attributes and the

relationship that exist between entities.

1  Entities: - An entity is any object, place, person, concept etc about

which data is recorded. It is an object which has an instance or 

occurrence and each instance should be  capable of being uniquely

identified. 

2  Attributes:-

 Attributes are data elements that describe an entity. 

3  Relationship: - This is the association between the entities. 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 10/65

 

SSYYSSTTEEMM R R EEQQUUIIR R EEMMEENNTT 

In order to install the software your system must the following

specification

1  Hardware Requirement:- 

 Processor  : Celorn processor 2.4 or Pentium III or 

higher 

 RAM  : 128 MB RAM

 HD Capacity : 2 G B HD or more

 Scanner  : Should be of good quality 

 Printer  : Inkjet B/W or color  

2  Software Requirement: - 

O perating System:  Windows 98 or higher version

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 11/65

 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 12/65

INTRODUCTION OF ³C´Languge 

C (pronounced /si/, like the letter C) is a general-purpose computer 

 programming language developed between 1969 and 1973 by Dennis

Ritchie at the Bell Telephone Laboratories for use with the Unix operating

system.[2]

 

Although C was designed for implementing system software,[5]

it is also

widely used for developing portable application software.

C is one of the most popular programming languages of all time[6][7]

and

there are very few computer architectures for which a C compiler does not

exist. C has greatly influenced many other popular programming languages,

most notably C++, which began as an extension to C.

Design

C is an imperative (procedural) systems implementation language. It was

designed to be compiled using a relatively straightforward compiler, to

 provide low-level access to memory, to provide language constructs that

map efficiently to machine instructions, and to require minimal run-time

support. C was therefore useful for many applications that had formerly been

coded in assembly language.

Despite its low-level capabilities, the language was designed to encourage

cross-platform programming. A standards-compliant and portably written C

 program can be compiled for a very wide variety of computer platforms and

operating systems with few changes to its source code. The language has

 become available on a very wide range of platforms, from embedded

microcontrollers to supercomputers.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 13/65

Charact er ist i c s

Like most imperative languages in the ALGOL tradition, C has facilities for 

structured programming and allows lexical variable scope and recursion,

while a static type system prevents many unintended operations. In C, all

executable code is contained within functions. Function parameters are

always passed by value. Pass-by-reference is simulated in C by explicitly

 passing pointer values. Heterogeneous aggregate data types (struct) allow

related data elements to be combined and manipulated as a unit. C program

source text is free-format, using the semicolon as a statement terminator.

C also exhibits the following more specific characteristics:

y  Partially weak typing; for instance, characters can be used as integers

y  Low-level access to computer memory by converting machine

addresses to typed pointers

y  Function and data pointers supporting ad hoc run-time polymorphism

y  array indexing as a secondary notion, defined in terms of pointer 

arithmetic

y  A preprocessor for macro definition, source code file inclusion, and

conditional compilation

y  Complex functionality such as I/O, string manipulation, and

mathematical functions consistently delegated to library routines

y  A large number of compound operators, such as +=, -=, *=, ++, etc.

K&R C

In 1978, Brian Kernighan and Dennis Ritchie published the first edition of 

T he C Progr ammin g Lan gua ge.[8]

This book, known to C programmers as

"K&R", served for many years as an informal specification of the language.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 14/65

The version of C that it describes is commonly referred to as  K&R C . The

second edition of the book [1]

covers the later ANSI C standard.

K&R introduced several language features:

y  standard I/O library

y  long int data type

y  unsigned int data type

y  compound assignment operators of the form =op (such as =-) were

changed to the form op= to remove the semantic ambiguity created by

such constructs as i=-10, which had been interpreted as i =- 10 

instead of the possibly intended i = -10 

Even after the publication of the 1989 C standard, for many years K&R C

was still considered the "lowest common denominator" to which C

 programmers restricted themselves when maximum portability was desired,

since many older compilers were still in use, and because carefully written

K&R C code can be legal Standard C as well.

In early versions of C, only functions that returned a non-int value needed

to be declared if used before the function definition; a function used without

any previous declaration was assumed to return type int, if its value was

used.

For example:

long some_function();

/* int */ other_function();

/* int */ calling_function()

{

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 15/65

long test1;

register /* int */ test2;

test1 = some_function();

if (test1 > 0)

test2 = 0;

else

test2 = other_function();

return test2;

}

All the above commented-out int declarations could be omitted in K&R C.

Since K&R function declarations did not include any information about

function arguments, function parameter type checks were not performed,

although some compilers would issue a warning message if a local function

was called with the wrong number of arguments, or if multiple calls to an

external function used different numbers or types of arguments. Separate

tools such as Unix's lint utility were developed that (among other things)

could check for consistency of function use across multiple source files.

In the years following the publication of K&R C, several unofficial features

were added to the language, supported by compilers from AT&T and some

other vendors. These included:

void functions (i.e. functions with no return value)y  functions returning struct or union types (rather than pointers)

y  assignment for struct data types

y  enumerated types

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 16/65

The large number of extensions and lack of agreement on a standard library,

together with the language popularity and the fact that not even the Unix

compilers precisely implemented the K&R specification, led to the necessity

of standardization.

ANSI C and ISO C

During the late 1970s and 1980s, versions of C were implemented for a wide

variety of mainframe computers, minicomputers, and microcomputers,

including the IBM PC, as its popularity began to increase significantly.

In 1983, the American National Standards Institute (ANSI) formed a

committee, X3J11, to establish a standard specification of C. In 1989, the

standard was ratified as ANSI X3.159-1989 "Programming Language C".

This version of the language is often referred to as ANSI C, Standard C, or 

sometimes C89.

In 1990, the ANSI C standard (with formatting changes) was adopted by the

International Organization for Standardization (ISO) as ISO/IEC 9899:1990,

which is sometimes called C90. Therefore, the terms "C89" and "C90" refer 

to the same programming language.

ANSI, like other national standards bodies, no longer develops the C

standard independently, but defers to the ISO C standard. National adoption

of updates to the international standard typically occurs within a year of ISO

 publication.

One of the aims of the C standardization process was to produce a superset

of K&R C, incorporating many of the unofficial features subsequently

introduced. The standards committee also included several additional

features such as function prototypes (borrowed from C++), void pointers,

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 17/65

support for international character sets and locales, and preprocessor 

enhancements. The syntax for parameter declarations was also augmented to

include the style used in C++, although the K&R interface continued to be

 permitted, for compatibility with existing source code.

C89 is supported by current C compilers, and most C code being written

today is based on it. Any program written only in Standard C and without

any hardware-dependent assumptions will run correctly on any platform

with a conforming C implementation, within its resource limits. Without

such precautions, programs may compile only on a certain platform or with a

 particular compiler, due, for example, to the use of non-standard libraries,

such as GUI libraries, or to a reliance on compiler- or platform-specificattributes such as the exact size of data types and byte endianness.

In cases where code must be compilable by either standard-conforming or 

K&R C-based compilers, the __STDC__ macro can be used to split the

code into Standard and K&R sections to prevent using on a K&R C-based

compiler features available only in Standard C.

C99

After the ANSI/ISO standardization process, the C language specification

remained relatively static for some time. In 1995 Normative Amendment 1

to the 1990 C standard was published, to correct some details and to add

more extensive support for international character sets. The C standard was

further revised in the late 1990s, leading to the publication of ISO/IEC

9899:1999 in 1999, which is commonly referred to as "C99". It has since

 been amended three times by Technical Corrigenda. The international C

standard is maintained by the working group ISO/IEC JTC1/SC22/WG14.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 18/65

C99 introduced several new features, including inline functions, several new

data types (including long long int and a complex type to represent

complex numbers), variable-length arrays, support for variadic macros

(macros of variable arity) and support for one-line comments beginning with

//, as in BCPL or C++. Many of these had already been implemented as

extensions in several C compilers.

C99 is for the most part backward compatible with C90, but is stricter in

some ways; in particular, a declaration that lacks a type specifier no longer 

has int implicitly assumed. A standard macro __STDC_VERSION__ is

defined with value 199901L to indicate that C99 support is available. GCC,

Sun Studio and other C compilers now support many or all of the new

features of C99.

C1X

In 2007, work began in anticipation of another revision of the C standard,

informally called "C1X". The C standards committee has adopted guidelines

to limit the adoption of new features that have not been tested by existingimplementations.

U ses

C is often used for "system programming", including implementing

operating systems and embedded system applications, due to a combination

of desirable characteristics such as code portability and efficiency, ability to

access specific hardware addresses, ability to pun types to match externally

imposed data access requirements, and low run-time demand on system

resources. C can also be used for website programming using CGI as a

"gateway" for information between the Web application, the server, and the

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 19/65

 browser.[9]

Some reasons for choosing C over interpreted languages are its

speed, stability, and near-universal availability.[10]

 

One consequence of C's wide acceptance and efficiency is that compilers,

libraries, and interpreters of other programming languages are often

implemented in C. The primary implementations of Python (CPython), Perl

5, and PHP are all written in C.

Due to its thin layer of abstraction and low overhead, C allows efficient

implementations of algorithms and data structures, which is useful for 

 programs that perform a lot of computations. For example, the GNU Multi-

Precision Library, the GNU Scientific Library, Mathematica and MATLAB

are completely or partially written in C.

C is sometimes used as an intermediate language by implementations of 

other languages. This approach may be used for portability or convenience;

 by using C as an intermediate language, it is not necessary to develop

machine-specific code generators. Some languages and compilers which

have used C this way are BitC, C++, COBOL, Eiffel, Gambit, GHC,

Squeak, and Vala. However, C was designed as a programming language,

not as a compiler target language, and is thus less than ideal for use as an

intermediate language. This has led to development of C-based intermediate

languages such as C--.

C has also been widely used to implement end-user applications, but much

of that development has shifted to newer languages.

Sy ntax  

C has a formal grammar specified by the C standard.[11]

Unlike languages

such as FORTRAN 77, C source code is free-form which allows arbitrary

use of whitespace to format code, rather than column-based or text-line-

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 20/65

 based restrictions. Comments may appear either between the delimiters /* 

and */, or (in C99) following // until the end of the line.

C source files contain declarations and function definitions. Function

definitions, in turn, contain declarations and statements. Declarations either 

define new types using keywords such as struct, union, and enum, or 

assign types to and perhaps reserve storage for new variables, usually by

writing the type followed by the variable name. Keywords such as char 

and int specify built-in types. Sections of code are enclosed in braces ({ 

and }, sometimes called "curly brackets") to limit the scope of declarations

and to act as a single statement for control structures.

As an imperative language, C uses  st atement  s to specify actions. The most

common statement is an expre ssion  st atement , consisting of an expression to

 be evaluated, followed by a semicolon; as a side effect of the evaluation,

functions may be called and variables may be assigned new values. To

modify the normal sequential execution of statements, C provides several

control-flow statements identified by reserved keywords. Structured

 programming is supported by if(-else) conditional execution and by do-

while, while, and for iterative execution (looping). The for statement

has separate initialization, testing, and reinitialization expressions, any or all

of which can be omitted. break and continue can be used to leave the

innermost enclosing loop statement or skip to its reinitialization. There is

also a non-structured goto statement which branches directly to the

designated label within the function. switch selects a case to be executed

 based on the value of an integer expression.

Expressions can use a variety of built-in operators (see below) and may

contain function calls. The order in which arguments to functions and

operands to most operators are evaluated is unspecified. The evaluations

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 21/65

may even be interleaved. However, all side effects (including storage to

variables) will occur before the next "sequence point"; sequence points

include the end of each expression statement, and the entry to and return

from each function call. Sequence points also occur during evaluation of 

expressions containing certain operators (&&, ||, ?: and the comma

operator). This permits a high degree of object code optimization by the

compiler, but requires C programmers to take more care to obtain reliable

results than is needed for other programming languages.

Although mimicked by many languages because of its widespread

familiarity, C's syntax has often been criticized. For example, Kernighan and

Ritchie say in the Introduction of T 

he C Progr ammin

 g Lan

 gua ge, "C, like

any other language, has its blemishes. Some of the operators have the wrong

 precedence; some parts of the syntax could be better."

Some specific problems worth noting are:

y   Not checking number and types of arguments prior to C99 when the

function declaration has an empty parameter list. (This provides

 backward compatibility with K&R C, which lacked prototypes.)

y  Some questionable choices of operator precedence, as mentioned by

Kernighan and Ritchie above, such as == binding more tightly than & 

and | in expressions like x & 1 == 0, which would need to be

written (x & 1) == 0 to be properly evaluated.

y  The use of the = operator, used in mathematics for equality, to

indicate assignment, following the precedent of Fortran and PL/I, but

unlike ALGOL and its derivatives. Ritchie made this syntax design

decision consciously, based primarily on the argument that

assignment occurs more often than comparison.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 22/65

y  Similarity of the assignment and equality operators (= and ==),

making it easy to accidentally substitute one for the other. In many

cases, each may be used in the context of the other without a

compilation error (although some compilers produce warnings). For 

example, the conditional expression in if (a=b) is true if a is not

zero after the assignment.[12]

 

y  A lack of infix operators for complex objects, particularly for string

operations, making programs which rely heavily on these operations

(implemented as functions instead) somewhat difficult to read.

y  A declaration syntax that some find unintuitive, particularly for 

function pointers. (Ritchie's idea was to declare identifiers in contexts

resembling their use: "declaration reflects use".)

Keywords

C89 has 32 keywords (reserved words with special meaning): auto,

break, case, char, const, continue, default, do, double,

else, enum, extern, float, for, goto, if, int, long, register,

return, short, signed, sizeof, static, struct, switch,

typedef, union, unsigned, void, volatile, and while.

C99 adds five more keywords: inline, restrict, _Bool, _Complex,

and _Imaginary.

Operators

supports a rich set of operators, which are symbols used within an

expression to specify the manipulations to be performed while evaluating

that expression. C has operators for:

y  arithmetic: +, -, *, /, % 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 23/65

y  assignment: = 

o  augmented assignment: +=, -=, *=, /=, %=, &=, |=, ^=, <<=,

>>= 

y   bitwise logic: ~, &, |, ^ 

y   bitwise shifts: <<, >> 

y   boolean logic: !, &&, || 

y  conditional evaluation: ? : 

y  equality testing: ==, != 

y  calling functions: ( ) 

y  increment and decrement: ++ and -- 

y  member selection: ., -> 

y  object size: sizeof 

y  order relations: <, <=, >, >= 

y  reference and dereference: &, *, [ ] 

y  sequencing: , 

y  subexpression grouping: ( ) 

y  type conversion: (typename) 

Data t ypes

C has a static weak typing type system that shares some similarities with that

of other ALGOL descendants such as Pascal. There are built-in types for 

integers of various sizes, both signed and unsigned, floating-point numbers,

characters, and enumerated types (enum). C99 added a boolean datatype.

There are also derived types including arrays, pointers, records (struct),

and untagged unions (union).

C is often used in low-level systems programming where escapes from the

type system may be necessary. The compiler attempts to ensure type

correctness of most expressions, but the programmer can override the checks

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 24/65

in various ways, either by using a type ca st to explicitly convert a value from

one type to another, or by using pointers or unions to reinterpret the

underlying bits of a value in some other way.

Pointers

C supports the use of pointers, a very simple type of reference that records,

in effect, the address or location of an object or function in memory. Pointers

can be d ereferenced  to access data stored at the address pointed to, or to

invoke a pointed-to function. Pointers can be manipulated using assignment

and also pointer arithmetic. The run-time representation of a pointer value is

typically a raw memory address (perhaps augmented by an offset-within-

word field), but since a pointer's type includes the type of the thing pointed

to, expressions including pointers can be type-checked at compile time.

Pointer arithmetic is automatically scaled by the size of the pointed-to data

type. (See Array-pointer interchangeability below.) Pointers are used for 

many different purposes in C. Text strings are commonly manipulated using

 pointers into arrays of characters. Dynamic memory allocation, which is

described below, is performed using pointers. Many data types, such as

trees, are commonly implemented as dynamically allocated struct objects

linked together using pointers. Pointers to functions are useful for callbacks

from event handlers.

A null pointer is a pointer that explicitly points to no valid location. Even

though it is created by setting a pointer to literal zero '0', it is not necessarily

zero.[14] Dereferencing a null pointer is therefore undefined, typically

resulting in a run-time error. Null pointers are useful for indicating special

cases such as no next pointer in the final node of a linked list, or as an error 

indication from functions returning pointers. In code, null pointers are

usually represented by 0 or NULL, and logically evaluate to false.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 25/65

Void pointers (void *) point to objects of unknown type, and can

therefore be used as "generic" data pointers. Since the size and type of the

 pointed-to object is not known, void pointers cannot be dereferenced, nor is

 pointer arithmetic on them allowed, although they can easily be (and in

many contexts implicitly are) converted to and from any other object pointer 

type.

Careless use of pointers is potentially dangerous. Because they are typically

unchecked, a pointer variable can be made to point to any arbitrary location,

which can cause undesirable effects. Although properly-used pointers point

to safe places, they can be made to point to unsafe places by using invalid

 pointer arithmetic; the objects they point to may be deallocated and reused(dangling pointers); they may be used without having been initialized (wild

 pointers); or they may be directly assigned an unsafe value using a cast,

union, or through another corrupt pointer. In general, C is permissive in

allowing manipulation of and conversion between pointer types, although

compilers typically provide options for various levels of checking. Some

other programming languages address these problems by using more

restrictive reference types.

Arrays

Array types in C are traditionally of a fixed, static size specified at compile

time. (The more recent C99 standard also allows a form of variable-length

arrays.) However, it is also possible to allocate a block of memory (of 

arbitrary size) at run-time, using the standard library's malloc function,

and treat it as an array. C's unification of arrays and pointers (see below)

means that true arrays and these dynamically-allocated, simulated arrays are

virtually interchangeable. Since arrays are always accessed (in effect) via

 pointers, array accesses are typically not checked against the underlying

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 26/65

array size, although the compiler may provide bounds checking as an option.

Array bounds violations are therefore possible and rather common in

carelessly written code, and can lead to various repercussions, including

illegal memory accesses, corruption of data, buffer overruns, and run-time

exceptions.

C does not have a special provision for declaring multidimensional arrays,

 but rather relies on recursion within the type system to declare arrays of 

arrays, which effectively accomplishes the same thing. The index values of 

the resulting "multidimensional array" can be thought of as increasing in

row-major order.

Multidimensional arrays are commonly used in numerical algorithms

(mainly from applied linear algebra) to store matrices. The structure of the C

array is well suited to this particular task. However, since arrays are passed

merely as pointers, the bounds of the array must be known fixed values or 

else explicitly passed to any subroutine that requires them, and dynamically

sized arrays of arrays cannot be accessed using double indexing. (A

workaround for this is to allocate the array with an additional "row vector"

of pointers to the columns.)

C99 introduced "variable-length arrays" which address some, but not all, of 

the issues with ordinary C arrays.

See also: C string

Array-pointer interchangeability

A distinctive (but potentially confusing) feature of C is its treatment of 

arrays and pointers. The array-subscript notation x[i] can also be used

when x is a pointer; the interpretation (using pointer arithmetic) is to access

the (i + 1)th object of several adjacent data objects pointed to by x,

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 27/65

counting the object that x points to (which is x[0]) as the first element of 

the array.

Formally, x[i] is equivalent to *(x + i). Since the type of the pointer 

involved is known to the compiler at compile time, the address that x + i 

 points to is not the address pointed to by x incremented by i bytes, but

rather incremented by i multiplied by the size of an element that x points to.

The size of these elements can be determined with the operator sizeof by

applying it to any dereferenced element of x, as in n = sizeof *x or n

= sizeof x[0].

Furthermore, in most expression contexts (a notable exception is as operandof sizeof), the name of an array is automatically converted to a pointer to

the array's first element; this implies that an array is never copied as a whole

when named as an argument to a function, but rather only the address of its

first element is passed. Therefore, although function calls in C use pass-by-

value semantics, arrays are in effect passed by reference.

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 28/65

 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 29/65

 

Screen Shot

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 30/65

 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 31/65

 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 32/65

 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 33/65

 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 34/65

 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 35/65

 

PROJ ECT 

CODE 

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 36/65

 /*--------------------------------------------------------------------*/   

 /*--------------------------------------------------------------------*/   

 /*--------------------------------------------------------------------*/   

 /*--------------------------------------------------------------------*/   

 /*  RESTAURENT MANAGEMENT SYSTEM  */  

 /*--------------------------------------------------------------------*/   

 /*--------------------------------------------------------------------*/   

 /*--------------------------------------------------------------------*/   

#include<stdio.h>

#include<conio.h>

#include<dos.h>

#include<string.h>

#include<graphics.h>

#define PAT  H ". gi"

#define TBG textbackground(W  H  ITE);textcolor(BLUE)

typedef struct customer 

{ long id;

char name[20];

char pn[12];

char BILLress[40];

char category;

int doj[3];

 }cust;

typedef struct F OO D 

{ long id;

char title[25];

int copy;

int cponshelf;

int issue;

char sid[20];

int loc;

 }mov;

typedef struct transaction{ 

long invoice;

int doi[3];

int dor[3];

char title[25];

int fine;

long cid;

char cname[20];

int copies;

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 37/65

int rent;

int tam;

 }transaction;

cust ctr;

mov mv;

transaction tran;

FILE *  fc,*  fm,*  ft,* tmp;long int size;

int days,k=0;

struct date d;

void main_menu()

char * menu[]={"CUST O MER SECTI O N",

"F OO D SECTI O N",

"TRANSACTI O N SECTI O N",

"EXIT"};

char ch;

int gd= D ETECT,gm,i,choice=0;

initgraph(&gd,&gm,PAT  H  );

setfillstyle(S O LI  D _FILL,RE  D );

bar(0,0,640,480);

title("MAIN MENU",180);

status();

box(0,menu[0]);

box(1,menu[1]);

box(2,menu[2]);box(3,menu[3]);

selectbox(choice,menu[choice]);

while((ch=getch())!=13)

switch(ch)

case 80:case 81:

choice++;

if(choice==4)

choice=0;

selectbox(choice,menu[choice]);

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

if(i==choice) continue;

box(i,menu[i]);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 38/65

}

break;

case 72:

case 73:

choice--;

if(choice==-1)

choice=3;

selectbox(choice,menu[choice]);

 for(i=0;i<=3;i++){ 

if(i==choice) continue;

box(i,menu[i]);

 }

 }

 }

 pressbutton(choice,menu[choice]);

switch(choice)

{ case 0:

size=sizeof(ctr);

customer();

break;

case 1:

F OO D();

break;

case 2:

transactions();

break;

case 3:closegraph();

restorecrtmode();

exit(0);

 }

 }

customer()

char * menu[]={ "BILL CUST O MER",

"SERVE T O CUST O MER",

" D ELETE CUST O MER",

"LIST CUST O MER",

"BACK T O MAIN MENU",

"EXIT"

 };

char ch;

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 39/65

int gd= D ETECT,gm;

int i,choice=0;

initgraph(&gd,&gm,PAT  H  );

setfillstyle(S O LI  D _FILL,RE  D );

bar(0,0,640,480);

title("CUST O MER MENU",130);

status();

box(0,menu[0]);

box(1,menu[1]);box(2,menu[2]);

box(3,menu[3]);

box(4,menu[4]);

box(5,menu[5]);

selectbox(choice,menu[choice]);

while((ch=getch())!=13)

switch(ch)

{ case 80:

case 81:

choice++;

if(choice==6)

choice=0;

selectbox(choice,menu[choice]);

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

if(i==choice) continue;

box(i,menu[i]);

 }break;

case 72:

case 73:

choice--;

if(choice==-1)

choice=5;

selectbox(choice,menu[choice]);

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

if(i==choice) continue;

box(i,menu[i]); }

 }

 }

 pressbutton(choice,menu[choice]);

closegraph();

restorecrtmode();

clrscr();

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 40/65

if((fc=fopen("c:customer.txt","rb+"))==NULL)

 fc=fopen("c:customer.txt","wb+");

switch(choice)

case 0:

 BILLcus();

break;

case 1:rewind(fc);

modify();

break;

case 2:

delete();

break;

case 3:

listcust();

break;

case 4:

 fclose(fc);main_menu();

break;

case 5:

 fclose(fc);

exit(1);

 }

 }

F OO D()

char * menu[]={ 

"BILL F OO D",

"LIST F OO D",

"SEARC  H F OO D",

"BACK T O MAIN MENU",

"EXIT"

 };

char ch;int gd= D ETECT,gm;

int i,choice=0;

initgraph(&gd,&gm,PAT  H  );

setfillstyle(S O LI  D _FILL,RE  D );

bar(0,0,640,480);

title("F OO D MENU",165);

status();

box(0,menu[0]);

box(1,menu[1]);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 41/65

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 42/65

break;

case 1:

listmov();

break;

case 2:

searchmov();

break;

case 3:

main_menu();break;

case 4:

 fclose(fm);

exit(1);

 }

 }

transactions()

char * menu[]={ 

"NEW TRANSACTI O N","CLO SE TRANSACTI O N",

"LIST TRANSACTI O NS",

"SEARC  H F OO D",

"BACK T O MAIN MENU",

"EXIT"

 };

char ch;

int gd= D ETECT,gm,i,choice=0;

initgraph(&gd,&gm,PAT  H  );

setfillstyle(S O LI  D _FILL,RE  D );bar(0,0,640,480);

title("TRANSACTI O N MENU",100);

status();

box(0,menu[0]);

box(1,menu[1]);

box(2,menu[2]);

box(3,menu[3]);

box(4,menu[4]);

box(5,menu[5]);

selectbox(choice,menu[choice]);

while((ch=getch())!=13)

switch(ch)

case 80:

case 81:

choice++;

if(choice==6)

choice=0;

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 43/65

selectbox(choice,menu[choice]);

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

if(i==choice) continue;

box(i,menu[i]);

 }

break;

case 72:

case 73:choice--;

if(choice==-1)

choice=5;

selectbox(choice,menu[choice]);

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

if(i==choice) continue;

box(i,menu[i]);

 }

 }

 }

 pressbutton(choice,menu[choice]);

closegraph();

restorecrtmode();

clrscr();

  ft=fopen("c: ransact.txt","rb+");

if(ft==NULL)

  ft=fopen("c: ransact.txt","wb+");

switch(choice)

{ case 0:

 BILLtran();

break;

case 1:

closetran();

break;

case 2:

listtran();

break;

case 3:

 fm=fopen("c:F OO D .txt","rb+");if(fm==NULL)

 fm=fopen("c:F OO D .txt","wb+");

searchmov();

break;

case 4:

main_menu();

break;

case 5:

exit(0);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 44/65

}

 }

 BILLcus()

char another='y';

 fseek(fc,0,SEEK_EN  D );

TBG;while(another=='y'||another=='Y')

clrscr();

 gotorc(2,24);

customid();

 gotorc(4,24);

 fflush(stdin);

 gets(ctr.name);

 gotorc(6,24); fflush(stdin);

 gets(ctr.pn);

 gotorc(8,24);

 fflush(stdin);

 gets(ctr.BILLress);

 gotorc(10,24);

 fflush(stdin);

 getdate(&d);

ctr.doj[0]=d.da_day;ctr.doj[1]=d.da_mon;ctr.doj[2]=d.da_year;

 printf("%d  / %d  / %d",d.da_day,d.da_mon,d.da_year);

 gotorc(12,24); fflush(stdin);

ctr.category=getche();

 gotorc(16,3);

 printf(" DO Y OU WANT T O SUBMIT T  H  IS F O RM (Y  /  N)");

 fflush(stdin);

another=getch();

if(another=='y'||another=='Y')

 fwrite(&ctr,size,1,fc);

 gotorc(18,3);

 printf(" DO Y OU WANT T O BILL AN OT  H  ER CUT O MER(Y  /  N)");

 fflush(stdin);another=getch();

 }

 fclose(fc);

customer();

 }

customid()

rewind(fc);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 45/65

if(fread(&ctr,sizeof(ctr),1,fc)!=1)

ctr.id=1;

else

while(fread(&ctr,sizeof(ctr),1,fc)==1);

ctr.id++;

 }

 printf("%ld",ctr.id);

 }

modify()

char another='y',choice,name[20],flag='n';

long id;

TBG;

while(another=='y'||another=='Y')

clrscr();rewind(fc);

  printf(" SEARC  H BY NAME : PRESS 1 SEARC  H BY I  D : PRESS 

2 ");

 fflush(stdin);

choice=getchar();

if(choice=='2')

 printf("ENTER CUST O MER I  D : ");

scanf("%ld",&id);while(fread(&ctr,size,1,fc)==1)

if(ctr.id==id)

new();

 flag='y';

break;

 }

 }

 }

if(choice=='1'){ 

 printf("ENTER CUST O MER NAME : ");

 fflush(stdin);

 gets(name);

while(fread(&ctr,size,1,fc)==1)

if(strcmpi(ctr.name,name)==0)

new();

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 46/65

flag='y';

break;

 }

 }

 }

if(flag=='n')

 gotorc(15,3);

 printf("CUST O MER N OT F OUN  D ............ !"); }

 gotorc(18,3);

 printf(" DO Y OU WANT T O SERVE T O AN OT  H  ER CUT O MER(Y  /  N)");

 fflush(stdin);

another=getch();

 }

 fclose(fc);

customer();

 }

new()

char another='y';

clrscr();

TBG;

 fseek(fc,-size,SEEK_CUR);

 printf("CUST O  MER'S NEW NAME :");

 printf("CUST O MER'S NEW P  H O NE N O :");

 printf("CUST O  MER'S NEW BILLRESS :");

 printf("NEW  D ATE OF J O INING (  DD<-|MM<-|YYYY<-|) :"); printf("NEW CATEG O RY(  H  /  A / C  /  R /  S  / T) :");

 gotorc(1,43);

 fflush(stdin);

 gets(ctr.name);

 gotorc(3,43);

 fflush(stdin);

 gets(ctr.pn);

 gotorc(5,43);

 fflush(stdin);

 gets(ctr.BILLress);

 gotorc(7,43); fflush(stdin);

scanf("%d",&ctr.doj[0]);

 gotorc(7,45);

 printf("%c",'  / ');

scanf("%d",&ctr.doj[1]);

 gotorc(7,48);

 printf("%c",'  / ');

scanf("%d",&ctr.doj[2]);

 gotorc(9,43);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 47/65

fflush(stdin);

ctr.category=getche();

 gotorc(16,3);

 printf("UP  D ATE T  H  E CUST O MER REC O R D (Y  /  N)");

 fflush(stdin);

another=getch();

if(another=='y'||another=='Y')

 fwrite(&ctr,size,1,fc);

rewind(fc); }

listcust()

int i=1,p=4;

clrscr();

TBG;

rewind(fc);

 printf("********************  CUST O MERS LIST ************ ");

 gotorc(2,3);

 printf("I  D");

 gotorc(2,8);

 printf("NAME");

 gotorc(2,22);

 printf("P  H O NE N O");

 gotorc(2,35);

 printf("BILLRESS"); gotorc(2,55);

 printf(" D .O .J");

 gotorc(2,68);

 printf("CATEG O RY");

while(fread(&ctr,size,1,fc)==1)

 gotorc(p,3);

 printf("%ld",ctr.id);

 gotorc(p,8);

 printf("%s",strupr(ctr.name));

 gotorc(p,22); printf("%s",ctr.pn);

 gotorc(p,35);

 printf("%s",strupr(ctr.BILLress));

 gotorc(p,55);

 printf("%d  / %d  / %d",ctr.doj[0],ctr.doj[1],ctr.doj[2]);

 gotorc(p,70);

 printf("%c",toupper(ctr.category));

if(i%15==0)

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 48/65

gotorc(40,3);

 printf("PRESS ANY KEY T O C O NTINUE.....");

 getch();

clrscr();

 p=4;

 }

 p+=2;

i++;

 }

 printf(" PRESS ANY KEY T O BACK T O CUST O MER MENU");

 getch();

customer();

 }

delete()

char another='y',choice,name[20],flag='n';long id;

tmp=fopen("c: emp.txt","wb");

rewind(fc);

TBG;

while(another=='y'||another=='Y')

clrscr();

 printf("  D ELETE BY NAME : 1  D ELETE BY I  D : 2 ");

 fflush(stdin);

choice=getchar();if(choice=='2')

 printf("ENTER CUST O MER I  D : ");

scanf("%ld",&id);

clrscr();

while(fread(&ctr,size,1,fc)==1)

if(ctr.id!=id)

 fwrite(&ctr,size,1,tmp);

else

 flag='y'; }

 }

if(choice=='1')

 fflush(stdin);

 gets(name);

clrscr();

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 49/65

while(fread(&ctr,size,1,fc)==1)

if(strcmpi(ctr.name,name)!=0)

 fwrite(&ctr,size,1,tmp);

else

 flag='y';

 }

 }

 fclose(fc); fclose(tmp);

remove("c:customer.txt");

rename("c: emp.txt","c:customer.txt");

if(flag=='n')

 printf("CUST O MER N OT F OUN  D .... !");

 printf(" DO Y OU WANT T O  D ELETE AN OT  H  ER CUT O MER(Y  /  N)");

 fflush(stdin);

another=getch();

 }

 fclose(fc);

customer(); }

 BILLmov()

char another='y';

TBG;

 fseek(fm,0,SEEK_EN  D );while(another=='y'||another=='Y')

clrscr();

 printf("*****************  BILL F OO D F O RM ***************** ");

 printf("F OO D I  D(NUMERIC) :");

 printf("F OO D NAME :");

 printf("N O OF C O  PIES :");

 printf("SUPPLIER I  D :");

 printf("LOCATI O  N :");

 gotorc(1,24);

movid(); gotorc(2,24);

 fflush(stdin);

 gets(mv.title);

 gotorc(3,24);

 fflush(stdin);

scanf("%d",&mv.copy);

mv.cponshelf=mv.copy;

mv.issue=0;

 gotorc(4,24);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 50/65

fflush(stdin);

 gets(mv.sid);

 gotorc(5,24);

 fflush(stdin);

scanf("%d",&mv.loc);

 fwrite(&mv,sizeof(mv),1,fm);

 printf(" DO Y OU WANT T O BILL AN OT  H  ER F OO D(Y  /  N)");

 fflush(stdin);

another=getch(); }

 fclose(fm);

 printf("PRESS ANY KEY T O BACK T O F OO D MENU");

F OO D();

 }

movid()

rewind(fm);if(fread(&mv,sizeof(mv),1,fm)!=1)

mv.id=1;

else

while(fread(&mv,sizeof(mv),1,fm)==1);

mv.id++;

 }

 printf("%ld",mv.id);

 }

listmov(){ 

int i=1,p=4;

textbackground(W  H  ITE);

textcolor(BLUE);

clrscr();

rewind(fm);

 printf("********************  F OO D LIST ***************** ");

 gotorc(2,1);

 printf("I  D");

 gotorc(2,5);

 printf("TITLE"); gotorc(2,25);

 printf("T OT_CP");

 gotorc(2,35);

 printf("CP_O _S  H  ELF");

 gotorc(2,48);

 printf("T OT_ISSUES");

 gotorc(2,59);

 printf("SUPPLIER I  D");

 gotorc(2,71);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 51/65

printf("LOCATI O N");

while(fread(&mv,sizeof(mv),1,fm)==1)

 gotorc(p,1);

 printf("%ld",mv.id);

 gotorc(p,5);

 printf("%s",strupr(mv.title));

 gotorc(p,28);

 printf("%d",mv.copy); gotorc(p,40);

 printf("%d",mv.cponshelf);

 gotorc(p,52);

 printf("%d",mv.issue);

 gotorc(p,59);

 printf("%s",mv.sid);

 gotorc(p,74);

 printf("%d",mv.loc);

if(i%10==0)

 printf("PRESS ANY KEY T O C O NTINUE....."); fflush(stdin);

 getch();

clrscr();

 p=4;

 }

i++;

 p+=2;

 }

 printf("PRESS ANY KEY T O BACK T O F OO D MENU");

 getch(); fclose(fm);

F OO D();

 }

searchmov()

char mname[20],another;

TBG;clrscr();

rewind(fm);

 gotorc(5,5);

 printf("ENTER F OO D TITLE : ");

 fflush(stdin);

 gets(mname);

while(fread(&mv,sizeof(mv),1,fm)==1)

if(strcmpi(mv.title,mname)==0)

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 52/65

 gotorc(7,12);

textcolor(0);

cprintf("F OO D F OUN  D ..");

textcolor(4);

 gotorc(9,5);

 printf("F OO D TITLE : %s",mv.title);

 gotorc(11,5);

 printf("T OTAL N O OF C O  PIES : %d",mv.copy); gotorc(13,5);

 printf("N O OF C O PIES AVAILABLE : %d",mv.cponshelf);

 gotorc(15,5);

 printf("SUPPLIER I  D : %s",mv.sid);

 gotorc(17,5);

 printf("LOCATI O  N : %d",mv.loc);

 gotorc(20,5);

 printf(" DO Y OU WANT T O SEARC  H M O RE F OO D(Y  /  N)");

 fflush(stdin);

another=getchar();

if(another=='y'||another=='Y')searchmov();

 fclose(fm);

F OO D();

 }

 }

 gotorc(7,5);

textcolor(4);

cprintf("F OO D N OT F OUN  D .....!");

textcolor(4);

 gotorc(12,5); printf(" DO Y OU WANT T O SEARC  H M O RE F OO D(Y  /  N)");

 fflush(stdin);

another=getchar();

if(another=='y'||another=='Y')

searchmov();

 fclose(fm);

F OO D();

 }

 BILLtran()

char another='y',rec;

TBG;

 fseek(ft,0,SEEK_EN  D );

while(another=='y'||another=='Y')

clrscr();

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 53/65

printf("*****************  TRANSACTI O N **************** ");

 printf("INV O ICE N O(NUMERIC) :");

 printf("F OO D TITLE :");

 printf("C O  PIES AVAILABLE :");

 printf("CUST O MER I  D :");

 printf("CUST O  MER NAME :");

 printf("N O . OF C O  PIES :");

 printf(" D ATE OF ISSUE :");

 gotorc(2,24);invoice();

 gotorc(4,24);

 fflush(stdin);

 gets(tran.title);

 gotorc(6,24);

avail();

 gotorc(8,24);

 fflush(stdin);

scanf("%ld",&tran.cid);

custcheck();

 gotorc(12,24); fflush(stdin);

scanf("%d",&tran.copies);

if(tran.copies>mv.cponshelf)

 gotorc(18,3);

 printf("TRANSACTI O N N OT P O SSIBLE : REQUIRE  D N O OF 

C O PIES N OT AVAILABLE");

 printf("PRESS ANY KEY T O BACK T O TRANSACTI O N MENU");

 getch();

transactions();

 } gotorc(14,24);

 fflush(stdin);

 getdate(&d);

tran.doi[0]=d.da_day;tran.doi[1]=d.da_mon;tran.doi[2]=d.da_year;

 printf("%d  / %d  / %d",d.da_day,d.da_mon,d.da_year);

tran.dor[0]=0;

tran.rent=0;

 gotorc(18,4);

 printf(" DO Y OU WANT T O REC O R D T  H  IS TRANSACTI O N(Y  /  N)");

rec=getchar();

if(rec=='y'||rec=='Y'){ 

update();

 fwrite(&tran,sizeof(tran),1,ft);

 }

 printf(" DO Y OU WANT T O BILL AN OT  H  ER TRANSACTI O N(Y  /  N)");

 fflush(stdin);

another=getch();

 }

 fclose(ft);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 54/65

printf("PRESS ANY KEY T O BACK T O TRANSACTI O N MENU");

transactions();

 }

custcheck()

if((fc=fopen("c:customer.txt","rb"))==NULL) fc=fopen("c:customer.txt","wb+");

rewind(fc);

while(fread(&ctr,sizeof(ctr),1,fc)==1)

if(ctr.id==tran.cid)

 gotorc(10,24);

 printf("%s",ctr.name);

strcpy(tran.cname,ctr.name);

 fclose(fc);

return; }

 }

 fclose(fc);

 gotorc(18,4);

 printf("INVALI  D CUST O MER ............!");

 gotorc(21,4);

 printf("PRESS ANY KEY T O BACK T O TRANSACTI O N MENU");

 getch();

transactions();

 }

invoice()

rewind(ft);

if(fread(&tran,sizeof(tran),1,ft)!=1)

tran.invoice=1;

else

while(fread(&tran,sizeof(tran),1,ft)==1);tran.invoice++;

 }

 printf("%ld",tran.invoice);

 }

avail()

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 55/65

fm=fopen("c:F OO D .txt","rb+");

if(fm==NULL)

 fm=fopen("c:F OO D .txt","wb+");

while(fread(&mv,sizeof(mv),1,fm)==1)

if(strcmpi(tran.title,mv.title)==0)

 printf("%d",mv.cponshelf);

 fclose(fm);return;

 }

 }

 gotorc(18,3);

 printf("%s","F OO D N OT F OUN  D ...!");

 gotorc(21,3);

 printf("PRESS ANY KEY T O RETURN");

 getch();

 fclose(fm);

transactions();

 }

update()

long msize;

msize=sizeof(mv);

 fm=fopen("c:F OO D .txt","rb+");

if(fm==NULL) fm=fopen("c:F OO D .txt","wb+");

while(fread(&mv,sizeof(mv),1,fm)==1)

if(strcmpi(tran.title,mv.title)==0)

mv.cponshelf=mv.cponshelf -tran.copies;

mv.issue=mv.issue+tran.copies;

 fseek(fm,-msize,SEEK_CUR);

 fwrite(&mv,sizeof(mv),1,fm);

break;

 } }

 fclose(fm);

return;

 }

listtran()

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 56/65

int i=1;

TBG;

clrscr();

rewind(ft);

while(fread(&tran,sizeof(tran),1,ft)==1)

  printf(" INV O ICE N O(NUMERIC) : %ld ",tran.invoice);

 printf("CUST O MER I  D : %ld ",tran.cid); printf("CUST O  MER NAME : %s ",tran.cname);

 printf("F OO D TITLE : %s ",tran.title);

 printf("N O . OF C O  PIES : %d ",tran.copies);

 printf(" D ATE OF ISSUE : %d  / %d  / %d 

",tran.doi[0],tran.doi[1],tran.doi[2]);

if(tran.dor[0]!=0)

 printf(" D ATE OF RETURN : %d  / %d  / %d 

",tran.dor[0],tran.dor[1],tran.dor[2]);

  printf("RENT : %d ",tran.rent);

  printf("FINE : %d ",tran.fine); printf("T OTAL AM OUNT : %d",tran.tam);

 }

 printf("........................................");

if(i%2==0)

 printf("PRESS ANY KEY T O C O NTINUE.....");

 getch();

clrscr();

 }i++;

 }

 fclose(ft);

 printf("PRESS ANY KEY T O BACK T O TRANSACTI O N MENU");

 getch();

transactions();

 }

closetran()

long id,sz;

TBG;

clrscr();

sz=sizeof(tran);

 printf("ENTER INV O ICE N O: ");

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 57/65

scanf("%ld",&id);

clrscr();

while(fread(&tran,sz,1,ft)==1)

if(tran.invoice==id)

if(tran.dor[0]!=0)

 gotorc(4,4); printf("T  H  IS TRANSACTI O N IS ALL REA DY CLO SE  D ...!");

 gotorc(7,4);

 printf("PRESS ANY KEY T O BACK T O TRANSACTI O N 

 MENU......");

 getch();

transactions();

 }

 fseek(ft,-sz,1);

 getdate(&d);

tran.dor[0]=d.da_day;tran.dor[1]=d.da_mon;tran.dor[2]=d.da_year;

difference();tran.rent=tran.copies* 25;

if(k==0)

tran.fine=0;

else

tran.fine=tran.copies* (k -1)* 5;

tran.tam=tran.rent+tran.fine;

 printf("INV O ICE N O(NUMERIC) : %ld ",tran.invoice);

 printf("CUST O MER I  D : %ld ",tran.cid);

 printf("CUST O  MER NAME : %s ",tran.cname);

 printf("F OO D TITLE : %s ",tran.title);

 printf("N O . OF C O  PIES : %d ",tran.copies); printf(" D ATE OF ISSUE : %d  / %d  / %d 

",tran.doi[0],tran.doi[1],tran.doi[2]);

 printf(" D ATE OF RETURN : %d  / %d  / %d 

",tran.dor[0],tran.dor[1],tran.dor[2]);

  printf("RENT : %d ",tran.rent);

  printf("FINE : %d ",tran.fine);

 printf("T OTAL AM OUNT : %d ",tran.tam);

updateclose();

 fwrite(&tran,sz,1,ft);

 fclose(ft);

 } }

 printf("PRESS ANY KEY T O BACK T O TRANSACTI O N MENU");

 getch();

transactions();

 }

difference()

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 58/65

int t,m1,m2,y1,y2,d1,d2;

d1=tran.doi[0];

d2=tran.dor[0];

m1=tran.doi[1];

m2=tran.dor[1];

 y1=tran.doi[2];

 y2=tran.dor[2];

t=m1;if(y2>y1)

while(y2>y1)

while(m1<=12)

check(m1,y1);

if(m1==t)

k=days-d1;

else

k=k+days;m1=m1+1;

 }

m1=1;y1++;

 }

while(m1<m2)

check(m1,y1);

k=k+days;

m1++;

 }

k=k+d2; }

else

if(m1!=m2)

while(m1<m2)

check(m1,y1);

if(m1==t)

k=days-d1;

elsek=k+days;

m1=m1+1;

 }

k=k+d2;

 }

else

k=d2-d1;

 }

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 59/65

}

check(int m1,int y1)

if(m1==1||m1==3||m1==5||m1==7||m1==8||m1==10||m1==12)

days=31;

else{ 

if(m1!=2)

days=30;

else

if(y1%4==0)

days=29;

else

days=28;

 }

 } }

updateclose()

long msize;

msize=sizeof(mv);

 fm=fopen("c:F OO D .txt","rb+");

if(fm==NULL)

 fm=fopen("c:F OO D .txt","wb+");while(fread(&mv,sizeof(mv),1,fm)==1)

if(strcmpi(tran.title,mv.title)==0)

mv.cponshelf=mv.cponshelf+tran.copies;

 fseek(fm,-msize,SEEK_CUR);

 fwrite(&mv,msize,1,fm);

break;

 }

 }

 fclose(fm);return;

 }

 gotorc(int r,int c)

union REGS i,o;

i.h.ah=2;

i.h.bh=0;

i.h.dh=r;

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 60/65

i.h.dl=c;

int86(16,&i,&o);

 }

screen1(){ 

int gd= D ETECT,gm;

initgraph(&gd,&gm,PAT  H  );

setfillstyle(S O LI  D _FILL,RE  D );

bar(0,0,640,480);

setfillstyle(S O LI  D _FILL,W  H  ITE);

bar(15,15,625,465);

setfillstyle(S O LI  D _FILL,RE  D );

bar(30,30,610,450);

settextstyle(1,0,8);

setcolor(W  H  ITE);outtextxy(190,35," H otel");

setfillstyle(S O LI  D _FILL,LIG  H TGRAY);

bar3d(180,140,385,130,20,20);

outtextxy(160,150,"Managment");

bar3d(140,255,440,245,20,20);

outtextxy(165,270,"SYSTEM");

bar3d(145,375,440,365,20,20);

 /* sleep(4); */  

 getch();

closegraph();

restorecrtmode(); }

screen2()

int gd= D ETECT,gm;

initgraph(&gd,&gm,PAT  H  );

setfillstyle(S O LI  D _FILL,RE  D );

bar(0,0,640,480);

setfillstyle(S O LI  D _FILL,W  H  ITE);

bar(15,15,625,465);setfillstyle(S O LI  D _FILL,RE  D );

bar(30,30,610,450);

setfillstyle(S O LI  D _FILL,LIG  H TGRAY);

bar3d(180,100,420,300,25,25);  /* members bar */  

settextstyle(1,1,10);

setcolor(W  H  ITE);

outtextxy(10,55,"IIMS");

setfillstyle(S O LI  D _FILL,LIG  H TGRAY);

bar3d(180,50,420,70,20,20);  /*  project members bar */  

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 61/65

bar3d(50,350,570,420,25,25);  /*  project guide bar */  

setcolor(BLUE);

settextstyle(1,0,2);

outtextxy(193,48,"PRO JECT MEMBERS");

outtextxy(193,130,"Ashish Gupta");

outtextxy(193,170,"Yasar Khan");

outtextxy(235,351,"PRO JECT GUI  D E:");

settextstyle(1,0,5);

outtextxy(140,373,"Miss Monika ");

 /* sleep(4); */  

 getch();

closegraph();

restorecrtmode(); }

box(int i,char *  p)

setfillstyle(S O LI  D _FILL,W  H  ITE);

bar(179,108+55* i,409,138+55* i);

setfillstyle(S O LI  D _FILL,LIG  H TGRAY);

bar(180,110+55* i,410,140+55* i);

setcolor(BLUE);

settextstyle(1,0,2);

outtextxy(184,110+55* i,p); /* getch();

setfillstyle(S O LI  D _FILL,W  H  ITE);

bar(180,60,390,90);

setfillstyle(S O LI  D _FILL,RE  D );

bar(179,59,389,89); */  

 /* bar3d(180,100,420,300,-25,25);*/   /* members bar */  

 /* closegraph();

restorecrtmode(); */  

 }

selectbox(int i,char *  p)

setfillstyle(S O LI  D _FILL,W  H  ITE);

bar(179,108+55* i,409,138+55* i);

setfillstyle(S O LI  D _FILL,9);

bar(180,110+55* i,410,140+55* i);

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 62/65

setcolor(W  H  ITE);

settextstyle(1,0,2);

outtextxy(184,110+55* i,p);

 /* getch();

setfillstyle(S O LI  D _FILL,W  H  ITE);

bar(180,60,390,90);

setfillstyle(S O LI  D _FILL,RE  D );

bar(179,59,389,89); */  

 /* bar3d(180,100,420,300,-25,25);*/   /* members bar */  

 /* closegraph();

restorecrtmode(); */  

 }

 pressbutton(int i,char *  p)

setfillstyle(S O LI  D _FILL,W  H  ITE);

bar(180,110+55* i,410,140+55* i);

setfillstyle(S O LI  D _FILL,9);

bar(179,108+55* i,409,138+55* i);

setcolor(CYAN);

settextstyle(1,0,2);

outtextxy(184,110+55* i,p);

delay(350);

 }

title(char * title,int x){ 

setfillstyle(S O LI  D _FILL,9);

bar(0,0,640,50);

setcolor(BLACK);

settextstyle(1,0,5);

outtextxy(x,0,title);

 }

status()

setfillstyle(S O LI  D _FILL,9);bar(0,450,640,480);

setcolor(BLACK);

settextstyle(1,0,3);

outtextxy(30,450,"USE UP &  DOWN ARROW KEYS T O SELECT AN 

O PTI O N");

 }

void main()

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 63/65

screen1();

screen2();

main_menu();

 }

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 64/65

Conclusion 

  Now ,as the user /reader has under gone through the listing AND other 

accessories details of the project work ,so we feel that the user must have

 become well acquainted with the aim AND feed back of this work. We wishthat the acquaintance of the user with this work revals a positive response

AND he/she finds this effort of ours in their good thoughts.

Of course, at the beginning ,project appeared very small,but when we

actually started the work , we encounterd its depth. This project work 

coverd every aspect of the customer management. The experience of our 

guide helped us a lot in this regard. This project gives us complete

satisfaction.

Thanks a million for going through our work ,because your viewing AND 

satisfaction is the reward for our work in developing this project to its  present shape.

Hope you rewind this«.

Thanks!

8/6/2019 RESTAURENT

http://slidepdf.com/reader/full/restaurent 65/65

 BIBLI OGRAP  H Y 

y  Let U  s C By: Y a shwant  K anetk ar . y

 T urbo C By:  Robert La fore. y Com plete  Reference C By: Herbert Shil d. y T each Your  self C By: Ak ank  sha Shar ma .