Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 68

GOVT. P.G.

COLLEGE FOR
WOMEN
ROHTAK

Submitted in the partial fulfillment for the requirement for


the award of Degree
M. Sc final ‘year (computer science)

A PROJECT REPORT
ON

(SESSION -2023 -2024)


Submitted by under the guidance of
anjali Mrs. rohini sharma
m.sc(comp.sci) associate professor
roll no. 602224

1
ACKNOWLEDGEMENT
After an intensive period of five months today is the day writing this note
of thanks is the finishing touch on my dissertation. It has been a period of
intense learning for me, not only in the scientific area, but also on a personal
level. I would like to reflect on the people who have supported and helped me so
much throughout this period. It is with great satisfaction and pride that I present
the Project on PRISION MANAGEMENT
SYSTEM during 4th Semester, for partial fulfillment of our Master of Science
(Computer Science) degree at Government PG College for Women, Rohtak. I
am thankful to Mrs. Rohini Sharma Associate Professor, for being my
mentor in this journey. I want to thank him for excellent cooperation and for all
of the opportunities. She provided me an excellent atmosphere for doing
research. I am also thank to HOD Mrs. NISHA MALIK for being a constant
source os inspiration and motivation during the course of the report. Last but not
the least, I want to acknowledge the contribution of my parents and family
member for their constant motivation, inspiration and their belief in me that I
could make it happen.

2
CONTENT
1. Chapter: INTRODUCTION
2. CHAPTER: ABOUT THE LANGUAGE USED
a. ADVANTAGES OF COMPUTER SYSTEM
b. DISADVANTAGES OF THE MANUAL SYSTEM
3. CHAPTER: SYSTEM ANALYSIS
4. CHAPTER: SYSTEM DESIGN
a) INPUT DESIGN
b) OUTPUT DESIGN
c) SYSTEM CONFIGURATION
d) MINIMUM REQUIREMENT
5. CHAPTER: CODING
6. CHAPTER: OUTPUT OF THE PROJECT
7. CHAPTER: CONCLUSION & RECOMMENDATION

8. FUTURE SCOPE OF THE PROJECT


REFERENCES / BIBLIOGRAPHY

3
About the language used
HISTORY OF C PROGRAMMING LANGUAGE
Evolution of C programming language C has often been termed as a "Pseudo high level
language" or a "Middle level language" by many programmers. This is not because of its lack
of programming power but because of its capability to access the system's low level
functions. In fact C was invented specifically to implement UNIX. C instructions are
compiled to assembly code, therefore, depending on the complexity of the code and on the
compiler optimization capabilities, C code may run as fast as assemby. Ken Thompson
created the B language in 1969 from Martin Richard's BCPL (Basic Combined Programming
Language). He used assembly language and B to produce the initial versions of the UNIX
operating system. BCPL and B were typeless languages in which variables were simply
words in memory. Dennis Ritchie of Bell Laboratories later converted B into C by retaining
most of B's syntax in 1972 and wrote the first compiler. This was implemented on DEC's
PDP 11 and it was first used as the system's language for rewriting the UNIX operating
system. Later on, UNIX, its tools and C grew simultaneously. In 1978, Kernighan and Ritchie
wrote a book entitled 'The C Programming Language' that became the language definition for
almost a decade. Beginning in 1983, the ANSI X3J11 committee was asked to standardize the
C language. The result was ANSI C, a standard which was adopted in 1988. It is not forced
upon any programmer, but since it is so widely accepted, it would be economically unwise
for any systems programmer or compiler writer not to conform to the standard. Features of C
Language · C is a procedure-based programming language. This means the program is
viewed as a means to solve a problem. Various functions modules or code blocks are thus,
written to solve this problem. · C functions can accept parameters and return values and
perform variety of tasks like input from the user, displaying the information, etc. · C is simple
and easy to learn and use. The main components like built in functions, operators, keywords
are small in number. · In C, errors are checked only at compile time. The compiled code
though have no safety checks for bad type casts, bad array indices, or bad pointers. · C works
best for small projects where performance is important. · C contains the capability of
assembly language with the features of high level language which can be used for creating
software packages, system software etc. · C is highly portable. C programs written on one
computer can run on other computer without making any changes in the program. ; Uses of C
C's wide acceptance and efficiency is the reason why libraries of several other applications
are often implemented in C. Some of the applications using C in its kernels are: Uses of C are
many in addition to Systems programming. Some of which are as follows : o Language
compilers and interpreters o Device drivers o Telecom applications o Network programming
o Digital Signal processing applications o Database applications o Text editors Compilers
available Most flavors of UNIX operating system have a C compiler. So if a student has
access to an UNIX system, he or she can straight away start coding and compiling C sample
programs and exercises given in this course. With respect to personal computers , Microsoft
C for IBM PC's and compatibles or Borland C are the two most commonly used
programming environments. There are a number of free C compilers available on the web for
installation on the PC, one can use them as HISTORY OF C PROGRAMMING

4
LANGUAGE Evolution of C programming language C has often been termed as a "Pseudo
high level language" or a "Middle level language" by many programmers. This is not because
of its lack of programming power but because of its capability to access the system's low
level functions. In fact C was invented specifically to implement UNIX. C instructions are
compiled to assembly code, therefore, depending on the complexity of the code and on the
compiler optimization capabilities, C code may run as fast as assemby. Ken Thompson
created the B language in 1969 from Martin Richard's BCPL (Basic Combined Programming
Language). He used assembly language and B to produce the initial versions of the UNIX
operating system. BCPL and B were typeless languages in which variables were simply
words in memory. Dennis Ritchie of Bell Laboratories later converted B into C by retaining
most of B's syntax in 1972 and wrote the first compiler. This was implemented on DEC's
PDP 11 and it was first used as the system's language for rewriting the UNIX operating
system. Later on, UNIX, its tools and C grew simultaneously. In 1978, Kernighan and Ritchie
wrote a book entitled 'The C Programming Language' that became the language definition for
almost a decade. Beginning in 1983, the ANSI X3J11 committee was asked to standardize the
C language. The result was ANSI C, a standard which was adopted in 1988. It is not forced
upon any programmer, but since it is so widely accepted, it would be economically unwise
for any systems programmer or compiler writer not to conform to the standard. Features of C
Language · C is a procedure-based programming language. This means the program is
viewed as a means to solve a problem. Various functions modules or code blocks are thus,
written to solve this problem. · C functions can accept parameters and return values and
perform variety of tasks like input from the user, displaying the information, etc. · C is simple
and easy to learn and use. The main components like built in functions, operators, keywords
are small in number. · In C, errors are checked only at compile time. The compiled code
though have no safety checks for bad type casts, bad array indices, or bad pointers. · C works
best for small projects where performance is important. · C contains the capability of
assembly language with the features of high level language which can be used for creating
software packages, system software etc. · C is highly portable. C programs written on one
computer can run on other computer without making any changes in the program. ; Uses of C
C's wide acceptance and efficiency is the reason why libraries of several other applications
are often implemented in C. Some of the applications using C in its kernels are: Uses of C are
many in addition to Systems programming. Some of which are as follows : o Language
compilers and interpreters o Device drivers o Telecom applications o Network programming
o Digital Signal processing applications o Database applications o Text editors Compilers
available Most flavors of UNIX operating system have a C compiler. So if a student has
access to an UNIX system, he or she can straight away start coding and compiling C sample
programs and exercises given in this course. With respect to personal computers , Microsoft
C for IBM PC's and compatibles or Borland C are the two most commonly used
programming environments. There are a number of free C compilers available on the web for
installation on the PC, one can use them well.

5
About C Language
The C Language is developed by Dennis Ritchie for creating system applications that directly
interact with the hardware devices such as drivers, kernels, etc.

C programming is considered as the base for other programming languages, that is why it is
known as mother language.

It can be defined by the following ways:

1. Mother language
2. System programming language
3. Procedure-oriented programming language
4. Structured programming language
5. Mid-level programming language

1) C as a mother language
C language is considered as the mother language of all the modern programming languages
because most of the compilers, JVMs, Kernels, etc. are written in C language, and most
of the programming languages follow C syntax, for example, C++, Java, C#, etc.

It provides the core concepts like the array, strings, functions, file handling, etc. that are being
used in many languages like C++, Java, C#, etc.

2) C as a system programming language


A system programming language is used to create system software. C language is a system
programming language because it can be used to do low-level programming (for example
driver and kernel). It is generally used to create hardware devices, OS, drivers, kernels, etc.
For example, Linux kernel is written in C.

It can't be used for internet programming like Java, .Net, PHP, etc.

3) C as a procedural language
A procedure is known as a function, method, routine, subroutine, etc. A procedural
language specifies a series of steps for the program to solve the problem.

A procedural language breaks the program into functions, data structures, etc.

6
C is a procedural language. In C, variables and function prototypes must be declared before
being used.

4) C as a structured programming language


A structured programming language is a subset of the procedural language. Structure means
to break a program into parts or blocks so that it may be easy to understand.

In the C language, we break the program into parts using functions. It makes the program
easier to understand and modify.

5) C as a mid-level programming language


C is considered as a middle-level language because it supports the feature of both low-level
and high-level languages. C language program is converted into assembly code, it supports
pointer arithmetic (low-level), but it is machine independent (a feature of high-level).

A Low-level language is specific to one machine, i.e., machine dependent. It is machine


dependent, fast to run. But it is not easy to understand.

A High-Level language is not specific to one machine, i.e., machine independent. It is easy
to understand.

Standard of c language
ANSI C and ISO C edit
Main article: ANSI 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. X3J11 based the C standard on the Unix
implementation; however, the non-portable portion of the Unix C library was handed off to
the IEEE working group 1003 to become the basis for the 1988 POSIX standard. In 1989, the
C 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 international C standard, maintained by the working group ISO/IEC
JTC1/SC22/WG14. National adoption of an update to the international standard typically
occurs within a year of ISO publication.

7
One of the aims of the C standardization process was to produce a superset of K&R C,
incorporating many of the subsequently introduced unofficial features. The standards
committee also included several additional features such as function prototypes (borrowed
from C++), void pointers, support for international character sets and locales, and
preprocessor enhancements. Although the syntax for parameter declarations was augmented
to include the style used in C++, the K&R interface continued to be permitted, for
compatibility with existing source code.
C89 is supported by current C compilers, and most modern C code 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-specific attributes such as the exact
size of data types and byte endianness.
In cases where code must be compatible 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 the use on a K&R C-based compiler of features available only in Standard C.
After the ANSI/ISO standardization process, the C language specification remained relatively
static for several years. In 1995, Normative Amendment 1 to the 1990 C standard (ISO/IEC
9899/AMD1:1995, known informally as C95) was published, to correct some details and to
add more extensive support for international character sets.[22]
C99edit
Main article: C99
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.[23]
C99 introduced several new features, including inline functions, several new data
types (including long int and a complex type to represent complex numbers), variable-
length arrays and flexible array members, improved support for IEEE 754 floating point,
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, Solaris Studio, and other C compilers now support many or all of
the new features of C99. The C compiler in Microsoft Visual C++, however, implements the
C89 standard and those parts of C99 that are required for compatibility with C++11.[24][needs
update]

In addition, the C99 standard requires support for identifiers using Unicode in the form of
escaped characters (e.g. \u0040 or \U0001f431) and suggests support for raw Unicode
names.
C11edit
Main article: C11 (C standard revision)

8
In 2007, work began on another revision of the C standard, informally called "C1X" until its
official publication of ISO/IEC 9899:2011 on 2011-12-08. The C standards committee
adopted guidelines to limit the adoption of new features that had not been tested by existing
implementations.
The C11 standard adds numerous new features to C and the library, including type generic
macros, anonymous structures, improved Unicode support, atomic operations, multi-
threading, and bounds-checked functions. It also makes some portions of the existing C99
library optional, and improves compatibility with C++. The standard
macro __STDC_VERSION__ is defined as 201112L to indicate that C11 support is available.
C17edit
Main article: C17 (C standard revision)
Published in June 2018 as ISO/IEC 9899:2018, C17 is the current standard for the C
programming language. It introduces no new language features, only technical corrections,
and clarifications to defects in C11. The standard macro __STDC_VERSION__ is defined
as 201710L to indicate that C17 support is available.
C23edit
Main article: C23 (C standard revision)
C23 is the informal name for the next (after C17) major C language standard revision. It was
informally known as "C2X" through most of its development. C23 is expected to be
published in early 2024 as ISO/IEC 9899:2024.[25] The standard macro __STDC_VERSION__ is
defined as 202311L to indicate that C23 support is available.
C2Yedit
C2Y is a temporary informal name for the next major C language standard revision, after C23
(C2X), that is hoped to be released later in the 2020s decade, per the two in "C2Y". An early
working draft of C2Y was released in February 2024 as N3220 by the working
group ISO/IEC JTC1/SC22/WG14.

9
Features of C Language

C is the widely used language. It provides many features that are given below.

1. Simple
2. Machine Independent or Portable
3. Mid-level programming language
4. structured programming language
5. Rich Library
6. Memory Management
7. Fast Speed
8. Pointers
9. Recursion
10. Extensible

10
Features of C Programming
1) Simple
C is a simple language in the sense that it provides a structured approach (to break the
problem into parts), the rich set of library functions, data types, etc.

2) Machine Independent or Portable


Unlike assembly language, c programs can be executed on different machines with some
machine specific changes. Therefore, C is a machine independent language.

3) Mid-level programming language


Although, C is intended to do low-level programming. It is used to develop system
applications such as kernel, driver, etc. It also supports the features of a high-level
language. That is why it is known as mid-level language

4) Structured programming language


C is a structured programming language in the sense that we can break the program into
parts using functions. So, it is easy to understand and modify. Functions also provide code
reusability.

5) Rich Library
C provides a lot of inbuilt functions that make the development fast.

6) Memory Management
It supports the feature of dynamic memory allocation. In C language, we can free the
allocated memory at any time by calling the free() function.

8) Pointer
C provides the feature of pointers. We can directly interact with the memory by using the
pointers. We can use pointers for memory, structures, functions, array, etc.

11
9) Recursion
In C, we can call the function within the function. It provides code reusability for every
function. Recursion enables us to use the approach of backtracking.

10) Extensible
C language is extensible because it can easily adopt new features.

A Simple Hello World Program


To start your journey in learning C programming language, let’s start with the “Hello,
World!” program. This program is often used as a beginner’s introduction to any
programming language and serves as a simple way to demonstrate the basic structure of a C
program.

#include <stdio.h>
int main()
{
printf(“Hello, World!\n”);
return 0;
}

In this program:
 #include <stdio.h>: This line includes the standard input/output library, which
provides the printf function for printing text to the console.
 int main(): This is the main function where the program execution begins.
The int before main indicates that the function returns an integer value.
 {}: The curly braces define the scope of the main function. Inside these braces, we
write the code that the function executes.
 printf("Hello, World!\n");: This line uses the printf function to display the text “Hello,
World!” followed by a newline character (\n) to the console.
 return 0;: Finally, the return 0; statement indicates that the program has terminated
successfully. The value 0 is typically used to indicate success, while non-zero values
can indicate errors.

Compile and run this program, and you’ll see the familiar “Hello, World!” message
displayed on your screen.

Data Types of C Programming


In C, data types are essential for specifying the kind of data that a variable
can hold and the operations that can be performed on it. C provides several
basic data types, which can be categorized into the following groups:

12
1. Basic Data Types

 int: Used for integer values, e.g., int x = 10;


 char: Represents a single character, e.g., char grade = 'A';
 float: Used for floating-point numbers, e.g., float price = 19.99;
 double: Similar to float but with higher precision, e.g., double pi = 3.14159;

2. Derived Data Types


 Array: A collection of elements of the same data type, e.g., int numbers[5];
 Pointer: A variable that stores the memory address of another variable, e.g., int *ptr;
 Structure: A user-defined composite data type, e.g., struct Person { char name[50];
int age; };

3. Enumeration Data Type


 Enum: A user-defined data type consisting of a set of named integer constants,
e.g., enum Days {Sunday, Monday, Tuesday};

These data types allow C programmers to declare variables, define functions, and manage
memory efficiently.

13
Functions
Functions are blocks of code that perform a specific task. They allow you to break your
program into smaller, manageable pieces, making it more organized and easier to maintain. In
C, every program must have a main function, which serves as the entry point to the program.

Loops and Their Types

Loops are used in programming to execute a block of code repeatedly until a certain
condition is met. C provides three main types of loops:

14
1. for loop
The for loop is used when you know the number of iterations you want to perform. It
consists of three parts: initialization, condition, and increment or decrement.

2. while Loop
The while loop is used when you want to execute a block of code as long as a certain
condition is true.

3. do-while Loop
The do-while loop is similar to the while loop, but it guarantees that the code block is
executed at least once before checking the condition.

Conditional Statements in C Programming


Conditional statements are essential for controlling the flow of your program and making it
more dynamic and responsive.

1. if statement: The if statement is used to execute a block of code if a specified condition is


true.

2. if-else statement: The if-else statement is used to execute one block of code if a
condition is true and another block of code if the condition is false.

3. switch statement: The switch statement is used to select one of many code blocks to be
executed.

Application of C Programming
C programming has a wide range of applications across various domains. Here
are some notable areas where C is commonly used:

1. System Software Development


C is often used to develop system software, including operating systems (e.g.,
Unix, Linux, Windows), device drivers, and firmware for embedded systems.
Its low-level capabilities make it suitable for tasks that require direct interaction
with hardware.

2. Application Software
C is used to build a variety of application software, such as text editors,
compilers, and databases. It provides the necessary tools and efficiency to create
robust and performance-critical applications.

3. Game Development
Many video games and game engines are developed in C or C++. These
languages offer the performance and control needed for real-time rendering and
complex game logic.

15
4. Embedded Systems
C is widely used in the development of embedded systems found in consumer
electronics, automotive systems, medical devices, and more. Its ability to work
with limited resources makes it a preferred choice in this domain.

5. Scientific Computing
C is used in scientific research and computational modeling due to its efficiency
in handling complex calculations. Researchers often use C for simulations, data
analysis, and scientific programming.

6. Web Development (Backend)


Although higher-level languages like Python and JavaScript dominate web
development, C can be used for developing web server software and optimizing
critical components of web applications.

7. Compilers and Interpreters


C is often used to create compilers and interpreters for other programming
languages. This bootstrapping process highlights C’s role in building the
foundations of other programming ecosystems

The Advantages Of C Language

C is a very popular language throughout the world and is ideal for a


programmer to learn at the beginning of their career. There is little vocabulary
to learn, the syntax is simple, and the modular structure of the language is
easier to learn.

1. It is easy to understand

One of the main reasons why people choose C over other programming
languages is its simplicity. C is a highly portable language as programs coded
in it are far more fast and efficient. This makes learning C easier than any other
programming language. You can easily grasp the concepts behind C because
there aren't many keywords or symbols involved. In addition, you don't need to
be an expert in computer science to get started with C programming. All you
have to do is take a few tutorials/ courses online and start writing your own
codes. Also, there are system-generated functions and user-defined functions in
C Language.

16
2. Presence of many Libraries

C Language provides lots of built-in functions, which consist of system-


generated functions and user-defined functions. Many general functions can be
used to develop a program, while the programmer can also create a function as
per their requirements, which is called a user-generated/defined function, in C
Compiler.

3. Easy to write

Another reason why C is so popular as an efficient language among


programmers is that it allows them to create their own software without having
to worry about syntax errors. If you're not familiar with coding, then using
structured language C will help you develop better skills. With C, you'll find
yourself creating more efficient and effective solutions compared to those
created by other programming languages.

4. Low cost

If you want to build something from scratch, then C is definitely worth


considering. Because of its simple structure, you won't spend too much time
trying to figure out whether you've made a mistake or not when developing
your program. And if you decide to hire someone else to complete the task,
they would only charge you less money.

5. Fast execution speed

If you want to execute your application quickly, then C is probably the right
choice for you. Since C uses fewer instructions, it executes faster than other
programming languages such as Java, Ruby, PHP, etc.

6. Portable

Since C is based on ASCII characters, it works well across different platforms,


including Windows, Linux, Mac OS X, Android, iOS, etc. Therefore, you
can run your C programs anywhere, regardless of where you live.
17
7. Easy debugging

Since C doesn't necessarily require complex statements


like loops, conditionals, variables, functions, arrays, pointers, etc., you can
debug your code easily. For example, if you encounter problems while
executing your program, just press CTRL+D to stop the process immediately.
Then, you can simply step back one line and continue working until you reach
the problematic statement.

8. Procedure Oriented Language

Users create procedures or functions to execute their tasks in C Language. It's


very easy to learn a procedure-oriented language because of the way it works
(algorithm to execute the statements you write). If you want to develop a
program using procedure-oriented language, you need to frame an algorithm
and start converting it into a function.

9. Speed of Compilation

The C compiler produces machine code very fast. Close to a thousand lines of
code can be put together in a couple of seconds. The C Compiler makes the
code more efficient for faster execution.

10. Execution of algorithms and data structures

The utilization of algorithms and data structures in C has made program


calculations extremely quick and smooth. Subsequently, the C language can be
employed in complex estimations and tasks like MATLAB.

11. Dynamic memory allocation

In C Language you can allocate memory dynamically or statically. In dynamic


allocation, we don't know how much space will be required for our data
structure at run time. But if we use static allocation then we need to reserve a
fixed amount of memory before starting the execution of the application. So

18
this feature makes us more flexible than other languages like Java where we
must declare all variables as final.

In dynamic memory allocation, you are allowed to distribute memory at run


time. For instance, considering that you don't have the foggiest idea of how
much memory is needed by objects in your program, then you can proceed to
run a program in C and appoint the memory simultaneously.

The Disadvantages Of C Language

1. Lack of Object Orientation

C is a very vast and powerful language and simply follows the procedural
programming approach. It doesn't extend its support to the concept of OOPs
(Inheritance, Polymorphism, Encapsulation, Abstraction, Data Hiding). Here,
you can't create a class with multiple inheritances like Java, Python, or C++. In
OOP languages like Java, we can inherit methods from the parent class. But
there is nothing similar in the C language. We cannot create subclasses for our
classes. So it makes it difficult to reuse existing codes.

2. Inefficient Memory Management

In C language, you don't need any memory management techniques because it


automatically manages all allocated resources for you. But if you want to use
dynamic allocation, then you should allocate dynamically by malloc function.
If you do this manually, then you will get a segmentation fault error. So, we
must always remember Memory Management Techniques.

3. No Garbage Collection

Garbage collection is a feature that automatically reclaims memory from


objects no longer needed by an application or library. It can be used for both
automatic and manual garbage collection. Automatic garbage collection occurs

19
when there is insufficient free space on the heap to allocate new objects; this
may occur because all available physical RAM was allocated to other processes
running on the computer system. Manual garbage collection involves explicitly
freeing unused blocks of memory with calls to functions such as malloc.

But in C/C++ languages, there's no such feature of garbage collection as the


culture of these languages is to leave storage management to the developer or
programmer. Hence, it would be technically tedious and harsh on pockets to
implement a precise garbage collector for C / C++.

4. Run-time checking

In the C programming language, the errors are not detected after each line of
code. The compiler shows all the errors in the code only during the run-time of
the whole which makes the checking of code (debugging) exceptionally
complex in enormous projects.

Also, the compiler doesn't check whether a variable was declared before its use.
The programmer must remember this rule while writing programs.

5. Concept of namespace is not present in C

C doesn't carry out the idea of namespaces. A namespace is organized as a


chain of commands to permit the reuse of names in various settings. Without
namespaces, we can't pronounce two factors of a similar name.

However, C programming is devoid of this feature, and consequently, you can't


characterize a variable with the same name in C.

6. Absence of Exception Handling

Special case Handling is perhaps the main element of programming dialects.


While compiling the code, different errors and bugs can happen. Exception
Handling permits you to identify the bugs and rectify them. Be that as it may, C
doesn't show this significant feature.

20
7. Lacks Constructor and Destructor

C doesn't have any object-oriented functionalities, and


hence, it doesn't have Constructor and Destructor
features. So, in C Language, you need to carry out the
manual construction and/or destruction of the variable,
either by utilizing a function or by different means.

21
Front-end & Backend used

Front-end used : “C” Language

Backend used : File `

22
ADVANTAGES OF THE COMPUTERIZED SYSTEM

1. Staff is reduced. Only a few people are required.

2. Timely & the better results are obtained.

3. Data can be stored in floppies or magnetic discs which are very compact.

4. Compilation in the mathematical calculation is reduced.

5. Any report (if necessary) can be generated much easily with slight

modification of the software accordingly.

6. Save a lot of clerical deskwork, as there is no effort in copying data is

various books.

7. Accurate results are obtained.

8. System is dependent of the volume of the transaction.

9. New reports can be generated easily when required, with only sight

modification of the software being developed.

DISADVANTAGES OF MANUAL SYSTEM

1. Searching for a particular record in the collected records becomes

very difficult.

23
2. To maintain the records i.e. to add, find & delete the records manually is

a very difficult task and also not neat and clean.

3. Due to the mathematically calculations in the fine amount may cause

trouble many times manually.

4. A large group of staff is employed.

5. Mathematical calculation involved may be error prone.

6. The whole process is time consuming.

7. Inconvenience is caused to any customer.

SYSTEM DESIGN

The computer approach in an interactive system that accepts inputs options and
provide the user with data and information. The main feature of this system is:
1. The user, using a CRT display device, uses system interactively.

2. To facilitate the user, a number of dialogs have been designed which

guide his actions.

3. Care has been taken to keep the user’s input simple to ensure accuracy of

input.

24
4. The output is presented in a well designed from by proper

formatting.
5. Subroutines have been implemented in the program to facilitate editing

and modifications.

6. Separate programs are written for different functions and given

meaningful names to make more memory space available for other

functions.

Dialogue Design:
Keeping in view user’s requirements, a number of dialogues have been designed
which help and guide the user wherever required. Such an arrangement helps in
an efficient communication between the user and the system. The main features
of the dialogues are:
a) Different types of dialogues have been designed for

the user keeping in view his requirements.

b) The dialogues have been designed in a way so that

they are easy to understand and selfexplanatory.

c) Error messages have been designed so as to reflect the

nature of mistake done by the user so as to guide his

further action. e.g. a beeping sound like bell rings for

a new value at the same spot.

d) The blinking effect is used to attract the attention of

user to particular command.

25
e) The dialogues are of leading type, which encourage

user’s response.

Input Design :
Since the system is used interactively, it has two types of inputs. Interactive
input which is the point of contact of the user with the system, and input to the
internal system i.e. data files.Data files are stored on the hard disk because it
provides quick access to data files. Files are created on-line and modification
and verification can be done easily.

For full efficiency of the system, it is necessary that input must be


accurate. Since the user of the system may not be technical person and may not
know input concepts so it is required that he may interact with the system in an
easy manner. For achieving this purpose, a promoting type of dialogue has to be
made. This dialogue instructs the user as and when needed.
Though the chances of errors during data storing have been minimized yet the
accuracy cannot be guaranteed.
Messages have been framed to handle such situations which helps the
user to re input correct data e.g., in case user makes mistakes while inputting the
options, it will immediately receive the messages “invalid entry” and the entered
option is cleared of the screen, and cursor again stand by for new input.

File Design :

One should keep in mind the following points before attempting to design a
file for any system:

a) External storage device.

b) The frequency of retrieving the records.

c) The mode of storing the data in order to have high package density.

26
d) The mode of storing information in order to achieve fast response

time.

e) Organization of the information with a view that it can be accessed

efficiently and accurately.

The response time of magnetic disk is very low and a large number of
updating can be performed easily. In this project floppy disks and hard
disks pack have been used.

Processing of files:

To get the output, program is loaded from hard disk and then run in dbase
IV. Processing of files is divided into four parts:
a) appendage: the data in the file created already is appended one by one

through the program loaded.

b) Viewing: to view data stored, file name is entered, file is opened, and

data are read and finally displayed on screen.

c) Updating: to update data, file name is required. On entering file name, old

data are displayed and options are asked as

update/add/delete.
d) Output: to get the output, the first thing is to choose the option, respective

file is opened, data are read, conversions are made and finally the output

is displayed on screen/printer.

Output Design :

27
The outputs have been designed so as to enhance readability
and uniformity. The outputs are taken on CRT and/or the
printer. The format of the CRT screen uses 80* 25 size i.e.
eighty characters per used uses both 80 characters and 132
characters paper for output.
Implementation:

Implementation is the stage of the project when the theoretical design is turned
in to working system. If the implementation storage is not carefully planned and
controlled, There may be problems. This can be considered as the crucial stage
in achieving a successful system and give user the confidence that the new
system will work and be effective. The system designed is implemented on Intel
–I5 processor.

SYSTEM CONFIGURATION

SYSTEM: INTEL core – I5 Processor Machine


COMPONENTS
i) Central Processor unit

ii) Laptop screen

iii) Keyboard

iv) Printer

v) Operating system

vi) software

i) Central Processor unit

a) Intel core –I5

b) Main Memory of 4GB

28
c) One Hard Disk of 1TB

d) One DVD-ROM Drive 52x


ii) LED

a) SVGA colored screen

b) Size: 80 * 25 character display

iii) Keyboard

a) Keyboard of 104 keys

iv) Printer

a) LASER JET PRINITER HP

b) Speed: 20 PPM

v) Operating system
a) Window 7
vi) IDE software

29
MINIMUM REQUIREMENT

COMPONENTS

i) Central Processor unit

ii) Laptop screen

iii) Keyboard

iv) Printer

v) Operating system

i) Central processor unit


a) Processor i5

b) Main Memory of 4GB

c) One Hard Disk of GB

ii) LED

a) SVGA colored screen

b)Size: 80 * 25 character display

iii) Keyboard
a) Keyboard of 104 keys

iv)Printer
a) Type: Laser printer (for Laser Printing)

b) Speed: 20ppm

v) Operating system

30
a) DOS

b) Window

c) Linux , Unix

31
EXISTING SYSTEM

The existing system depends upon manual operation i.e. report work kept in
simple files, maintain the data but any small mistake can lead to a big problem.
For example to check the existence of any customer or the fee record in
the hotel can be done by the help of computers much easily rather manually.
Other drawbacks in the existing system are: ---
Searching for a particular record in the collected records becomes very difficult.
To maintain the records i.e. to modify, add & delete the records manually is a
very difficult task and also not neat and clean. Due to the mathematically
calculations in the fine amount may cause trouble many times manually. A large
group of staff is employed. Mathematical calculation involved may be error
prone. The whole process is time consuming. Inconvenience is caused to any
customer.
It is very difficult to carry and store all the registers relating to customer
information’s and Bill. All of them in the form of paper documents.
Record keeping is quite difficult.

32
CODING

OUTPUT
#include<stdio.h>

#include<stdlib.h>

#include<conio.h>

#include<string.h>

void addrecord();

void viewrecord();

void editrecord();

void searchrecord();

void deleterecord();

void login();

struct record

33
{

char id[10];

char name[30];

char age[6];

char gender[10];

char weight[20];

char height[20];

char haircolor[20];

char eyecolor[20];

char crime[40];

char convictedf[20];

char court[20];

char lawyer[20];

char punishment[50];

char punishments[20];

char punishmente[20];

34
char emergencyc[20];

char emergencyr[20];

char emergencyn[20];

} a;

int main()

login();

int ch;

printf("\n\n\t***********************************\n");

printf("\t\t*PRISONER RECORD*\n");

printf("\t***********************************");

while(1)

printf("\n\n\t\tMAIN MENU:");

printf("\n\n\tADD RECORD\t[1]");

printf("\n\tSEARCH RECORD\t[2]");

printf("\n\tEDIT RECORD\t[3]");

printf("\n\tVIEW RECORD\t[4]");

printf("\n\tDELETE RECORD\t[5]");

printf("\n\tEXIT\t\t[6]");

printf("\n\n\tENTER YOUR CHOICE:");

35
scanf("%d",&ch);

switch(ch)

case 1:

addrecord();

break;

case 2:

searchrecord();

break;

case 3:

editrecord();

break;

case 4:

viewrecord();

break;

case 5:

deleterecord();

break;

case 6:

system("cls");

printf("\n\n\t\tTHANK YOU FOR USING THIS SOFTWARE \n\t\t THIS PROJECT IS BROUGHT TO YOU
BY code-projects.or

getch();

exit(0);

36
default:

printf("\nYOU ENTERED WRONG CHOICE.");

printf("\nPRESS ANY KEY TO TRY AGAIN");

getch();

break;

system("cls");

return 0;

//*********************************************************

/**************** ADDING FUNCTION************************/

//*********************************************************

void addrecord( )

system("cls");

FILE *fp ;

char another = 'Y' ,id[10];

char filename[30];

int choice;

printf("\n\n\t\t***************************\n");

printf("\t\t* WELCOME TO THE ADD MENU *");

37
printf("\n\t\t***************************\n\n");

printf("\n\n\tENTER FIRST NAME OF PRISONER:\t");

fflush(stdin);

gets(filename);

fp = fopen ("filename", "ab+" ) ;

if ( fp == NULL )

fp=fopen("filename","wb+");

if(fp==NULL)

printf("\nSYSTEM ERROR...");

printf("\nPRESS ANY KEY TO EXIT");

getch();

return ;

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

choice=0;

fflush(stdin);

printf ( "\n\tENTER PRISONER ID:\t");

scanf("%s",id);

38
rewind(fp);

while(fread(&a,sizeof(a),1,fp)==1)

if(strcmp(a.id,id)==0)

printf("\n\tTHE RECORD ALREADY EXISTS.\n");

choice=1;

if(choice==0)

strcpy(a.id,id);

printf("\tENTER PRISONER NAME: ");

fflush(stdin);

gets(a.name);

printf("\tENTER GENDER: ");

gets(a.gender);

fflush(stdin);

printf("\tENTER AGE: ");

gets(a.age);

fflush(stdin);

39
printf("\tENTER WEIGHT: ");

gets(a.weight);

fflush(stdin);

printf("\tENTER HEIGHT: ");

gets(a.height);

fflush(stdin);

printf("\tENTER HAIRCOLOR: ");

gets(a.haircolor);

fflush(stdin);

printf("\tENTER EYECOLOR: ");

gets(a.eyecolor);

fflush(stdin);

printf("\tENTER CRIME: ");

gets(a.crime);

fflush(stdin);

printf("\tENTER THE PLACE WHERE THE PRISONER WAS CONVICTED: ");

gets(a.convictedf);

fflush(stdin);

printf("\tENTER COURT: ");

gets(a.court);

fflush(stdin);

printf("\tENTER LAWYER: ");

gets(a.lawyer);

fflush(stdin);

40
printf("\tENTER CONVICTION: ");

gets(a.punishment);

fflush(stdin);

printf("\tENTER THE DATE PUNISHMENT STARTED AT: ");

gets(a.punishments);

fflush(stdin);

printf("\tENTER THE DATE PUNISHMENT ENDS AT: ");

gets(a.punishmente);

fflush(stdin);

printf("\tENTER NAME OF EMERGENCY CONTACT: ");

gets(a.emergencyc);

fflush(stdin);

printf("\tENTER RELATION OF EMERGENCY CONTACT WITH PRISONER: ");

gets(a.emergencyr);

fflush(stdin);

printf("\tENTER PHONE NUMBER OF EMERGENCY CONTACT: ");

gets(a.emergencyn);

fwrite ( &a, sizeof ( a ), 1, fp ) ;

printf("\nYOUR RECORD IS ADDED...\n");

printf ( "\n\tADD ANOTHER RECORD...(Y/N) \t" ) ;

fflush ( stdin ) ;

41
another = getch( ) ;

fclose ( fp ) ;

printf("\n\n\tPRESS ANY KEY TO EXIT...");

getch();

//***********************************************************

/**************** SEARCHING FUNCTION************************/

//***********************************************************

void searchrecord( )

system("cls");

FILE *fp ;

char id[16],choice,filename[14];

int ch;

printf("\n\n\t\t*******************************\n");

printf("\t\t* HERE IS THE SEARCHING MENU *");

printf("\n\t\t*******************************\n\n");

do

printf("\n\tENTER THE PRISONER NAME TO BE SEARCHED:");

fflush(stdin);

42
gets(filename);

fp = fopen ( "filename", "rb" ) ;

//system("cls");

printf("\nENTER PRISONER ID:");

gets(id);

system("cls");

printf("\nTHE WHOLE RECORD IS:");

while ( fread ( &a, sizeof ( a ), 1, fp ) == 1 )

//{

if(strcmpi(a.id,id)==0)

{ printf("\n");

printf("\nPRISONER'S NAME IS: %s",a.name);

printf("\nPRISONER'S GENDER IS: %s",a.gender);

printf("\nPRISONER'S AGE IS: %s",a.age);

printf("\nPRISONER'S WEIGHT IS: %s",a.weight);

printf("\nPRISONER'S HEIGHT IS: %s",a.height);

printf("\nPRISONER'S HAIRCOLOR IS: %s",a.haircolor);

printf("\nPRISONER'S EYECOLOR IS: %s",a.eyecolor);

printf("\nPRISONER'S CRIME IS: %s",a.crime);

printf("\nTHE PLACE WHERE THE PRISONER WAS CONVICTED IS: %s",a.convictedf);

printf("\nCOURT IS: %s",a.court);

printf("\nPRISONER'S LAWYER IS: %s",a.lawyer);

printf("\nPRISONER'S CONVICTION IS: %s",a.punishment);

printf("\nTHE DATE PUNISHMENT STARTED AT IS: %s",a.punishments);

printf("\nTHE DATE PUNISHMENT ENDS AT IS: %s",a.punishmente);

43
printf("\nPRISONER'S EMERGENCY CONTACT IS: %s",a.emergencyc);

printf("\nRELATION OF EMERGENCY CONTACT WITH PRISONER IS: %s",a.emergencyr);

printf("\nEMERGENCY CONTACT'S PHONE NUMBER IS: %s",a.emergencyn);

printf("\n");

// }

printf("\n\nWOULD YOU LIKE TO CONTINUE VIEWING...(Y/N):");

fflush(stdin);

scanf("%c",&choice);

while(choice=='Y'||choice=='y');

fclose ( fp) ;

getch();

return ;

getch();

//*********************************************************

/**************** EDITING FUNCTION************************/

//*********************************************************

void editrecord()

44
system("cls");

FILE *fp ;

char id[10],choice,filename[14];

int num,count=0;

printf("\n\n\t\t*******************************\n");

printf("\t\t* WELCOME TO THE EDITING MENU *");

printf("\n\t\t*******************************\n\n");

do

printf("\n\tENTER THE PRISONER NAME TO BE EDITED:");

fflush(stdin);

gets(filename);

printf("\n\tENTER ID:");

gets(id);

fp = fopen ( "filename", "rb+" ) ;

/*if ( fp == NULL )

printf( "\nRECORD DOES NOT EXIST:" ) ;

printf("\nPRESS ANY KEY TO GO BACK");

getch();

return;

}*/

45
while ( fread ( &a, sizeof ( a ), 1, fp ) == 1 )

if(strcmp(a.id,id)==0)

printf("\nYOUR OLD RECORD WAS AS:");

printf("\nPRISONER'S NAME: %s",a.name);

printf("\nPRISONER'S GENDER: %s",a.gender);

printf("\nPRISONER'S AGE: %s",a.age);

printf("\nPRISONER'S WEIGHT: %s",a.weight);

printf("\nPRISONER'S HEIGHT: %s",a.height);

printf("\nPRISONER'S HAIRCOLOR: %s",a.haircolor);

printf("\nPRISONER'S EYECOLOR: %s",a.eyecolor);

printf("\nPRISONER'S CRIME: %s",a.crime);

printf("\nTHE PLACE WHERE THE PRISONER WAS CONVICTED: %s",a.convictedf);

printf("\nCOURT: %s",a.court);

printf("\nPRISONER'S LAWYER: %s",a.lawyer);

printf("\nPRISONER'S CONVICTION: %s",a.punishment);

printf("\nTHE DATE PUNISHMENT STARTED AT: %s",a.punishments);

printf("\nTHE DATE PUNISHMENT ENDS AT: %s",a.punishmente);

printf("\nPRISONER'S EMERGENCY CONTACT: %s",a.emergencyc);

printf("\nRELATION OF EMERGENCY CONTACT WITH PRISONER: %s",a.emergencyr);

printf("\nEMERGENCY CONTACT'S PHONE NUMBER: %s",a.emergencyn);

printf("\n\n\t\tWHAT WOULD YOU LIKE TO EDIT..");

46
printf("\n1.NAME.");

printf("\n2.GENDER.");

printf("\n3.AGE.");

printf("\n4.WEIGHT.");

printf("\n5.HEIGHT.");

printf("\n6.HAIRCOLOR.");

printf("\n7.EYECOLOR.");

printf("\n8.CRIME.");

printf("\n9.PLACE WHERE THE PRISONER WAS CONVICTED.");

printf("\n10.COURT.");

printf("\n11.LAWYER.");

printf("\n12.CONVICTION.");

printf("\n13.STARTING DATE OF PUNISHMENT.");

printf("\n14.ENDING DATE OF PUNISHMENT.");

printf("\n15.EMERGENCY CONTACT.");

printf("\n16.RELATION OF EMERGENCY CONTACT.");

printf("\n17.EMERGENCY CONTACT'S PHONE NUMBER.");

printf("\n18.WHOLE RECORD.");

printf("\n19.GO BACK TO MAIN MENU.");

do

printf("\n\tENTER YOUR CHOICE:");

fflush(stdin);

scanf("%d",&num);

fflush(stdin);

switch(num)

47
case 1:

printf("\nENTER THE NEW DATA:");

printf("\nNAME:");

gets(a.name);

break;

case 2:

printf("\nENTER THE NEW DATA:");

printf("\nGENDER:");

gets(a.gender);

break;

case 3:

printf("\nENTER THE NEW DATA:");

printf("\nAGE:");

gets(a.age);

break;

case 4:

printf("\nENTER THE NEW DATA:");

printf("\nWEIGHT:");

gets(a.weight);

break;

case 5:

printf("ENTER THE NEW DATA:");

printf("\nHEIGHT:");

gets(a.height);

break;

case 6:

48
printf("ENTER THE NEW DATA:");

printf("\nHAIRCOLOR:");

gets(a.haircolor);

break;

case 7:

printf("ENTER THE NEW DATA:");

printf("\nEYECOLOR:");

gets(a.eyecolor);

break;

case 8:

printf("ENTER THE NEW DATA:");

printf("\nCRIME:");

gets(a.crime);

break;

case 9:

printf("ENTER THE NEW DATA:");

printf("\nPLACE:");

gets(a.convictedf);

break;

case 10:

printf("ENTER THE NEW DATA:");

printf("\nCOURT:");

gets(a.court);

break;

case 11:

printf("ENTER THE NEW DATA:");

49
printf("\nLAWYER:");

gets(a.lawyer);

break;

case 12:

printf("ENTER THE NEW DATA:");

printf("\nCONVICTION:");

gets(a.punishment);

break;

case 13:

printf("ENTER THE NEW DATA:");

printf("\nSTARTING DATE OF PUNISHMENT:");

gets(a.punishments);

break;

case 14:

printf("ENTER THE NEW DATA:");

printf("\nENDING DATE OF PUNISHMENT:");

gets(a.punishmente);

break;

case 15:

printf("ENTER THE NEW DATA:");

printf("\nEMERGENCY CONTACT:");

gets(a.emergencyc);

break;

case 16:

printf("ENTER THE NEW DATA:");

printf("\nRELATION OF EMERGENCY CONTACT:");

50
gets(a.emergencyr);

break;

case 17:

printf("ENTER THE NEW DATA:");

printf("\nPHONE NUMBER OF EMERGENCY CONTACT:");

gets(a.emergencyc);

break;

case 18:

printf("ENTER THE NEW DATA:");

printf("\tPRISONER NAME:");

gets(a.name);

printf("\tGENDER:");

gets(a.gender);

printf("\tAGE:");

gets(a.age);

printf("\tWEIGHT:");

gets(a.weight);

printf("\tHEIGHT:");

gets(a.height);

printf("\tHAIRCOLOR:");

gets(a.haircolor);

printf("\tEYECOLOR:");

gets(a.eyecolor);

printf("\tCRIME:");

gets(a.age);

printf("\tTHE PLACE WHERE THE PRISONER WAS CONVICTED:");

gets(a.convictedf);

printf("\tCOURT:");

gets(a.court);

51
printf("\tLAWYER:");

gets(a.lawyer);

printf("\tCONVICTION:");

gets(a.punishment);

printf("\tTHE DATE PUNISHMENT STARTED AT:");

gets(a.punishments);

printf("\tTHE DATE PUNISHMENT ENDS AT:");

gets(a.punishmente);

printf("\tNAME OF EMERGENCY CONTACT:");

gets(a.emergencyc);

printf("\tRELATION OF EMERGENCY CONTACT WITH PRISONER:");

gets(a.emergencyr);

printf("\tPHONE NUMBER OF EMERGENCY CONTACT:");

gets(a.emergencyn);

break;

case 19:

printf("\nPRESS ANY KEY TO GO BACK...\n");

getch();

return ;

break;

default:

printf("\nYOU TYPED SOMETHING ELSE...TRY AGAIN\n");

break;

while(num<1||num>20);

52
fseek(fp,-sizeof(a),SEEK_CUR);

fwrite(&a,sizeof(a),1,fp);

fseek(fp,-sizeof(a),SEEK_CUR);

fread(&a,sizeof(a),1,fp);

choice=5;

break;

if(choice==5)

system("cls");

printf("\n\t\tEDITING COMPLETED...\n");

printf("--------------------\n");

printf("THE NEW RECORD IS:\n");

printf("--------------------\n");

printf("\nPRISONER'S NAME IS: %s",a.name);

printf("\nPRISONER'S GENDER IS: %s",a.gender);

printf("\nPRISONER'S AGE IS: %s",a.age);

printf("\nPRISONER'S WEIGHT IS: %s",a.weight);

printf("\nPRISONER'S HEIGHT IS: %s",a.height);

printf("\nPRISONER'S HAIRCOLOR IS: %s",a.haircolor);

53
printf("\nPRISONER'S EYECOLOR IS: %s",a.eyecolor);

printf("\nPRISONER'S CRIME IS: %s",a.crime);

printf("\nTHE PLACE WHERE THE PRISONER WAS CONVICTED IS: %s",a.convictedf);

printf("\nCOURT IS: %s",a.court);

printf("\nPRISONER'S LAWYER IS: %s",a.lawyer);

printf("\nPRISONER'S CONVICTION IS: %s",a.punishment);

printf("\nTHE DATE PUNISHMENT STARTED AT IS: %s",a.punishments);

printf("\nTHE DATE PUNISHMENT ENDS AT IS: %s",a.punishmente);

printf("\nPRISONER'S EMERGENCY CONTACT IS: %s",a.emergencyc);

printf("\nRELATION OF EMERGENCY CONTACT WITH PRISONER IS: %s",a.emergencyr);

printf("\nEMERGENCY CONTACT'S PHONE NUMBER IS: %s",a.emergencyn);

fclose(fp);

printf("\n\n\tWOULD YOU LIKE TO EDIT ANOTHER RECORD.(Y/N)");

scanf("%c",&choice);

count++;

else

printf("\nTHE RECORD DOES NOT EXIST::\n");

printf("\nWOULD YOU LIKE TO TRY AGAIN...(Y/N)");

scanf("%c",&choice);

while(choice=='Y'||choice=='y');

fclose ( fp ) ;

54
printf("\tPRESS ENTER TO EXIT EDITING MENU.");

getch();

//*********************************************************

/**************** VIEWING FUNCTION************************/

//*********************************************************

void viewrecord()

system("cls");

FILE *fp;

//struct record a;

char filename[30];

printf("\n\n\t\t***************************\n");

printf("\t\t * LIST OF PRISONERS *");

printf("\n\t\t***************************\n\n");

fp=fopen("filename","rb");

rewind(fp);

while((fread(&a,sizeof(a),1,fp))==1)

printf("||NOTE:-PRESS ENTER KEY TO LOAD OTHER RECORDS||\n");

printf("\nPRISONER'S NAME IS: %s",a.name);

printf("\nPRISONER'S GENDER IS: %s",a.gender);

printf("\nPRISONER'S AGE IS: %s",a.age);

printf("\nPRISONER'S WEIGHT IS: %s",a.weight);

printf("\nPRISONER'S HEIGHT IS: %s",a.height);

55
printf("\nPRISONER'S HAIRCOLOR IS: %s",a.haircolor);

printf("\nPRISONER'S EYECOLOR IS: %s",a.eyecolor);

printf("\nPRISONER'S CRIME IS: %s",a.crime);

printf("\nTHE PLACE WHERE THE PRISONER WAS CONVICTED IS: %s",a.convictedf);

printf("\nCOURT IS: %s",a.court);

printf("\nPRISONER'S LAWYER IS: %s",a.lawyer);

printf("\nPRISONER'S CONVICTION IS: %s",a.punishment);

printf("\nTHE DATE PUNISHMENT STARTED AT IS: %s",a.punishments);

printf("\nTHE DATE PUNISHMENT ENDS AT IS: %s",a.punishmente);

printf("\nPRISONER'S EMERGENCY CONTACT IS: %s",a.emergencyc);

printf("\nRELATION OF EMERGENCY CONTACT WITH PRISONER IS: %s",a.emergencyr);

printf("\nEMERGENCY CONTACT'S PHONE NUMBER IS: %s",a.emergencyn);

getch();

printf("\n\n");

fclose(fp);

getch();

//*********************************************************

/**************** DELETING FUNCTION************************/

//*********************************************************

void deleterecord( )

system("cls");

56
FILE *fp,*ft ;

struct record file ;

char filename[15],another = 'Y' ,id[16];;

int choice,check;

int j=0;

char pass[8];

printf("\n\n\t\t*************************\n");

printf("\t\t* WELCOME TO DELETE MENU*");

printf("\n\t\t*************************\n\n");

printf("\nENTER PASSWORD\n");

int i;

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

pass[i]=getch();

printf("*");

if (strcmpi(pass,"pass")==0)

printf("\n\t\t*ACCESS GRANTED*\n\n");

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

printf("\n\tENTER THE NAME OF PRISONER TO BE DELETED:");

fflush(stdin);

gets(filename);

fp = fopen ("filename", "rb" ) ;

if ( fp == NULL )

57
{

printf("\nTHE FILE DOES NOT EXIST");

printf("\nPRESS ANY KEY TO GO BACK.");

getch();

return ;

ft=fopen("temp","wb");

if(ft==NULL)

printf("\nSYSTEM ERROR");

printf("\nPRESS ANY KEY TO GO BACK");

getch();

return ;

printf("\n\tENTER THE ID OF RECORD TO BE DELETED:");

fflush(stdin);

gets(id);

while(fread(&file,sizeof(file),1,fp)==1)

if(strcmp(file.id,id)!=0)

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

fclose(ft);

fclose(fp);

remove("filename");

58
rename("temp","filename");

printf("\nDELETED SUCCESFULLY...");

getch();

printf("\n\tDO YOU LIKE TO DELETE ANOTHER RECORD.(Y/N):");

fflush(stdin);

scanf("%c",&another);

printf("\n\n\tPRESS ANY KEY TO EXIT...");

getch();

else

printf("\nSorry!Invalid password\n");

exit(0);

void login()

int a=0,i=0;

char uname[10],c=' ';

char pword[10],code[10];

char user[10]="user";

char pass[10]="pass";

do

59
{

printf("\n ************************** LOGIN FORM ************************** ");

printf(" \n ENTER USERNAME:-");

scanf("%s", &uname);

printf(" \n ENTER PASSWORD:-");

while(i<10)

pword[i]=getch();

c=pword[i];

if(c==13) break;

else printf("*");

i++;

pword[i]='\0';

//char code=pword;

i=0;

//scanf("%s",&pword);

if(strcmp(uname,"user")==0 && strcmp(pword,"pass")==0)

printf(" \n\n\n WELCOME TO PRISON MANAGEMENT SYSTEM !! YOUR LOGIN IS


SUCCESSFUL");

printf("\n\n\n\t\t\t\tPress any key to continue...");

getch();//holds the screen

break;

else

printf("\n SORRY !!!! LOGIN IS UNSUCESSFUL");

a++;

60
getch();//holds the screen

while(a<=2);

if (a>2)

printf("\nSorry you have entered the wrong username and password for four times!!”)

printf("\nSorry you

getch();

system("cls");

61
OUTPUTS

62
Main menu:

63
ADD RECORD

64
ADD RECORD

65
ADD RECORD

66
ADD RECORD

67
68

You might also like