Академический Документы
Профессиональный Документы
Культура Документы
Submitted By
Ashish Verma
Enrollment No:
ODL/05/401/395
2
SOFTDOT HI-TECH EDUCATION & TRAINING INSTITUTE
K-16 South Ex Part-I
NEW DELHI-110049
PHONE: 24601315
Contents
1. Certificate……………………………………………………. 4
2. Acknowledgement…………………………………………… 5
3. Introduction to C-Programming…………………………… 6
4. User Manual…………………………………………………. 13
5. Software Requirement Specification………………………. 16
5.1 Software requirement specification
5.2 Hardware requirement specification
6. System Analysis Design………………………………………20
7. Data Flow Diagram…………………………………………..32
8. E-R Diagram………………………………………………….43
9. Flow Chart……………………………………………………52
10. Coding………………………………………………………...64
11. Output……………………………………………………….. 96
12. Testing……………………………………………………….113
13. Bibliography………………………………………………...118
3
CERTIFICATE OF ORIGINALITY
This is to certify that the project report entitled “Automation of Departmental store”
0DL/05/401/395 under the guidance of Ms. Deepika Singh and Mr. Jay Prakash Jay.
The matter embodied in this project is a genuine work done by the student and has
not been submitted whether to this University or to any other University / Institute for the
4
ACKNOWLEDGEMENT
I, Ashish Verma, express my deep sense of gratitude and indebt ness to the
faculty members of Softdot Hi-tech education & training institute and my
guides, Ms. Deepika Singh & Mr. Jay Prakash Jay, under whose inspiring
guidance, valuable suggestions, constant encouragement and kind
supervision, with her help, the present project on “Automation of
Departmental Store” was carried out.
I also wish to express our indebt ness to those who helped us during the
preparation of the manuscript of this text.
Your Name
Ashish Verma
5
6
1. Introduction to C Programming
Objectives
This section is designed to give you a general overview of the C
programming language. Although much of this section will be expanded in
later sections it gives you a taste of what is to come.
Why use C?
C has been used successfully for every type of programming problem
imaginable from operating systems to spreadsheets to expert systems - and
efficient compilers are available for machines ranging in power from the
Macintosh to the Cray supercomputers. The largest measure of C's success
seems to be based on purely practical considerations:
• the portability of the compiler;
• the standard library concept;
• a powerful and varied repertoire of operators;
• an elegant syntax;
• ready access to the hardware when needed;
• and the ease with which applications can be optimized by hand-coding
isolated procedures
C is often called a "Middle Level" programming language. This is not a
reflection on its lack of programming power but more a reflection on its
capability to access the system's low level functions. Most high-level
languages (e.g. FORTRAN) provide everything the programmer might want
to do already build into the language. A low level language provides nothing
other than access to the machines basic instruction set. A middle level
language, such as C, probably doesn't supply all the constructs found in
high-languages - but it provides you with all the building blocks that you
will need to produce the results you want!
Uses of C
C was initially used for system development work, in particular the
programs that make-up the operating system. Why use C? Mainly because it
produces code that runs nearly as fast as code written in assembly language.
Some examples of the use of C might be:
• Operating Systems
• Language Compilers
• Assemblers
7
• Text Editors
• Print Spoolers
• Network Drivers
• Modern Programs
• Data Bases
• Language Interpreters
• Utilities
In recent years C has been used as a general-purpose language because of its popularity
with programmers. It is not the world's easiest language to learn and you will certainly
benefit if you are not learning C as your first programming language! C is trendy (I
nearly said sexy) - many well established programmers are switching to C for all sorts of
reasons, but mainly because of the portability that writing standard C programs can offer.
A Brief History of C
C is a general-purpose language which has been closely associated with the
operating system for which it was developed - since the system and most of
the programs that run it are written in C.
Many of the important ideas of C stem from the language BCPL, developed
by Martin Richards. The influence of BCPL on C proceeded indirectly
through the language B, which was written by Ken Thompson in 1970 at
Bell Labs, for the first UNIX system on a PDP-7. BCPL and B are "type
less" languages whereas C provides a variety of data types.
In 1972 Dennis Ritchie at Bell Labs writes C and in 1978 the publication of
The C Programming Language by Kernighan & Ritchie caused a revolution
in the computing world.
In 1983, the American National Standards Institute (ANSI) established a
committee to provide a modern, comprehensive definition of C. The
resulting definition, the ANSI standard, or "ANSI C", was completed late
1988.
8
Program Design
Program design is the foundation for a good program and is therefore an important part of
the program development cycle. Before coding a program, the program should be well
convinced and all aspects of the program design should be considered in detail.
Program design is basically concerned with the development of a strategy to
be used in writing the program, in order to achieve the solution of a problem.
This includes mapping out a solution procedure and the form the program
would take .The program design involves the following stages:
1. Problem analysis
2. Outlining the program structure.
3. Algorithm or Flow Chart development.
4. Selection of control structures.
Problem Analysis
Before we think of a solution procedure to the problem, we must fully understand the
nature of the problem and what we want the program to do. Without the comprehension
and definition of the problem at hand, program design might turn into a hit-or-miss
approach. We must carefully decide the following at this stage:
-What kind of data will go in,
-What kind of outputs are needed, and
-What are the constraints and conditions under which the program has to
operate.
Problem
9
Task Task Task 3
T1 T1 T3 T3
T2 T2
Control Statements
A complex solution procedure may involve a large number of control
statements to direct the flow of execution. In such situations, indiscriminate
use of control statements such as go to may lead to unreadable and
incomprehensible programs. It has been demonstrated that any algorithm can
be structured, using the three basic control structures, namely-sequence
structure, selection structure, and looping structure.
10
Program Coding
A program written by one may have to be red by others later. Therefore, it should be
readable and simple to understand. Complex logic and tricky coding should be avoided.
The elements of coding style include internal documentation, construction of statements,
generality of the program, and input/output formats.
Internal Documentation
Documentation refers to the details that describe a program. Details may be built-in-as an
integral part of the program. Two important aspects of internal documentation are
selection of meaningful variable names and the use of components, Selection of
meaningful names is crucial for understanding the program. Example,
Area=breadth*length;
Is more meaningful than a=b*l;
Statement Construction
Although the flow of logic is decided during design, the construction of individual
statements is done at the coding stage. Each statement should be simple and direct.
The guidelines for construction of statements are:
1. Use one statement per line.
2. Use proper indentation when selection and looping structures are implemented.
3. Avoid heavy nesting of loops, preferably not more than three levels.
4. Use simple conditional tests; if necessary break complicated conditions into
simple conditions.
5. Use parentheses to clarify logical and arithmetic expressions.
6. Use space, wherever possible, to improve readability.
Input/Output Formats
It should be simple and acceptable to users. A number of guidelines should be
considered during coding.
1. Keep formats simple.
2. Use end-of-file indicators, rather than the user requiring to specify the
number of items.
3. Label all interactive input requests.
4. Label all output reports.
5. Use output messages when the output contains some peculiar results.
Missing Semicolons
Every C statement must end with a semicolon. A missing semicolon may cause
considerable confusion to the compiler and result in ‘misleading’ error messages.
11
There may be an instance when a missing semicolon might cause the compiler to
go ‘crazy’ and to produce a series of error messages.
Missing Braces
It is common to forgot a closing brace when coding a deeply nested loop. It will
be usually detected by the compiler because the number of opening braces should
match with the closing ones.
Another serious problem with the braces is, not using them when multiple
statements are to be grouped together.
Missing Quotes
Every string must be enclosed in double quotes, while a single character constant
in single quotes. If we miss them out, the string (or the character) will be
interpreted as a variable name.
Undeclared Variables
C requires variable to be declared for its type, before it is used. During the
development of a large program, it is quite possible to use a variable to hold
intermediate results and to forget to declare it.
Program Testing
Program testing is the process of reviewing and executing a program with the
intent of detecting errors, which may belong to any of the four kinds discussed
above. We know that while the compiler can detect syntactic and semantic errors,
it cannot detect run-time and logical errors that show up during the execution of
the program. Testing, therefore should be necessary including steps to detect all
possible errors in the program. Testing process includes two stages:
1. Human testing
2. Computer-based testing.
Human testing is an effective error-detection process and is done before the
computer-based testing begins. Human testing methods include code inspection
by the programmer, code inspection by a test group, and a review by a peer group.
The test is carried out statement by statement and is analyzed with respect to a
checklist of common programming errors. In addition to finding the errors, the
programming style and choice of algorithm are also reviewed.
12
13
USER MANUAL
This page will act as guide for all the new users. This is an application
about a departmental store where you find different kinds of products
you want to purchase/sell.
Following are the list of options when you open the application
In detail
1) Information about products
To view this option you have to press 1 on keyboard. Then a page will be
displayed which will have two choices.
Edibles
General products
These two choices contain the product list. Each product will be having a
product id, company name and rack number.
14
To view this option you have to press 5 on the keyboard then a screen will be
displayed which will give you option to delete the record of the product by
giving its id or its description. If the id or the records matches the record it
will de deleted otherwise the record is not found.
7) Print record
To view this option you have to press 7 on the keyboard. This option will help
in taking out a printout.
8) Barograph of quantity\profit
To view this option you have to press 8 on the keyboard. Then a screen will
appear which will sow you graphical representation of the profit earned and
products sold and purchased.
9) Retrieve information
To view this option you have to press h on the keyboard , then a page will
appear which will show how to use this application and how each application
works.
10) Exit
Press E to exit this application and return to windows.
15
16
REQUIREMENT SPECIFICATION
REQUIREMENT ANALYSIS
REQUIREMENT DOCUMENTATION
18
SOFTWARE REQUIREMENT SPECIFICATION
SOFTWARES REQUIREMENTS
1. Operating System : - Windows 98,99,2000,XP, NT
2. C compiler : - Turbo, Borland
HARDWARE REQUIREMENTS
SYSTEM TYPE : Pentium
MEMORY : 256 MB
HARD DISK : 20 GB
PRINTER : LASER
19
20
SYSTEM ANALYSIS
System analysis describes the detailed description of the scenario, and the
functioning of the system. The transaction and input/output requirements are also
presented. The problems in the current system are discussed and the necessary
improvements are recommended.
o System Design
System Design :
System Analysis :
SOFTWARE MODEL
WATERFALL MODEL
21
COMMUNICATION
project
Initiation
requirements
gathering PLANNING
Estimating
Scheduling
Tracking
MODELING
Analysis
Design
CONSTRUCTION
Code
Test
DEPLOYMENT
Delivery
Support
Feedback
The phases always occur in this order that they do not overlap. The developer
must complete each phase before the next phase begins. This model is named
“Waterfall Model” because its diagrammatic representation resembles a cascade of
waterfalls.
22
Requirement analysis
and specification
Design
Implementation and
unit testing
Operation and
Maintenance
23
REQUIREMENT ANALYSIS AND SPECIFICAION PHASE
DESIGN PHASE:
The SRS document contains the exact requirements of the customer. The
goal of this phase is to transform the requirements specification into a structure that
is suitable for implementation in some programming language. Here overall
software architecture is defined, and the high level and detailed design work is
performed. This work is documented and known as software design description
(SDD) document. The information contained in the SDD should be sufficient to
begin the coding phase.
This is a very important phase effective testing will contribute to the delivery
of higher quality software products, more satisfied users, lower maintenance costs
and more accurate and reliable results. Unit testing is used for implementing each
independent module correctly, due to which there are less chances that whether the
interface between modules are correct, for this reason integration testing is
performed. System testing involves the testing of the entire System, where as
software is the part of the System.
24
OPERATION AND MAINTENANCE PHASE :
MODEL CHOSEN
The model chosen for this project is “Waterfall Model” because of the
following reasons:-
25
FEASIBILITY STUDY
All the projects are feasible given unlimited resources and infinite time.
Unfortunately, the development of a computer based system is more likely to be
played by a scarcity of resources and difficult delivery date. It is both necessary and
prudent to evaluate the feasibility of a project at the earliest possible time. In the
development of the present project, no such limitation was imposed that was not
feasible, s all the resources where easily available and time given was sufficient
enough.
This involves question such as whether the technology needed for the system
exists, how difficult it will be to build and whether the firm has enough experience
using that technology.
The software made is on C++ which is a very common language, so we can
get the experienced persons in it very easily.
1. ECONOMIC FEASIBILITY
This involves questions such as whether the form can afford to built the
system, whether its benefits should substantially exceed its costs, and whether the
project has higher priority and profits than other projects that might use the same
resources.
Since, our project is made on C++ it is not very costly as it is very common
available software. We don’t need any extra software or hardware requirements or
any GUI (Graphic user interface)
2. TECHNICAL FEASIBILITY
This involves question such as whether the technology needed for the system
exists, how difficult it will be to build and whether the firm has enough experience
using that technology.
The software made is on C++ which is a very common language, so we can
get the experienced persons in it very easily.
26
3. LEGAL FEASIBILITY
All projects must face legal scrutiny. When an organization either has legal
council on staff or on retainer, such reviews are typically standard. However, any
project may face legal issue after completing too. Our software is legally feasible.
4. ORGANISATIONAL FEASIBILITY
This involves question such as whether the System has enough support to be
implemented successfully, whether it brings an excessive amount of change, and
whether the organization is changing too rapidly to absorb it.
Since, it is a very small project its purpose is for submission of BCA (3 year)
degree and all the members are equally include for the submission of project. So,
there is a good Coordinating among all the members.
5. ENVIRONMENTAL FEASIBILITY
People are inherently resistant to change and computers have been known to
facilitate change. An estimate should be made of how strong a reaction the user staff
is likely to have towards the development of a computerized system.
27
SCHEDULING
PERT CHART
T=1mo t=3mo
D F
T=2mo
T=3mo
A E
B
T=4mo C T=3mo
28
PERT model was invented by BOOZ Allen Hamilton, inc. under contract of
United States Department of Defence’s US NAVY special projects office in 1958 as
a part of the Polaris mobile submarine launched ballistic missile project
PERT was developed primarily to simplify the planning and scheduling of
large and complex projects.
BENEFITS OF PERT
LIMITATIONS OF PERT
29
5) Determine the critical path.
6) Update the PERT chart as the project progresses.
GANTT CHART
o A Gantt chart allows you to asses how long a project should take.
o A Gantt chart lays out the order in which tasks need to be carried
out.
o A Gantt chart helps manage the dependencies between tasks.
MONITORING A PROJECT
o A Gantt chart allows you to see immediately what should have been achieved
at a point in time.
o A Gantt chart allows you to see how remedial action may bring the
project back on course.
TIMELINE/GANTT CHART
30
Time in days
0 15 30 45 60 75 90 105 120
Activity
1. v
1.1
1.2
1.3
1.4
v
2.
2.1
2.2
2.3
2.4
3 v
4 v
5 v
31
32
Important factors to be considered while working on interfaces:
Now that we are familiar with the various design elements, let us take
a look at the modeling techniques that are used for designing the
systems. Data Flow Diagrams are used for functional modeling. As
the name suggests, it is a diagram depicting the flow of data through
the system. In the next section, we'll explore this technique in detail.
33
A Data Flow Diagram (DFD) is used to describe the logical operation
of a system, i.e. what a system does. DFD shows the flow of data
through a system and the work or processing performed by, that
system
DFDs only represent the flow of data through the system and do not
describe the physical functioning of' the system. DFDs are basically
of 2 types: Physical and logical ones. Physical DFDs are used in the
analysis phase to study the functioning of the current system. Logical
DFDs are used in the design phase for depicting the flow of data in
proposed system.
Data Flow Diagrams are composed of the four basic symbols shown
below.
Processes
Processes are work or actions performed on incoming data flows to
produce outgoing data flows. These show data transformation or
change. Data coming into a Process must be "worked on" or
transformed in some way. Thus, all processes must have inputs and
outputs. In some (rare) cases, data inputs or outputs will only be
34
shown at more detailed levels of the diagrams. Each process in
always "running" and ready to accept data.
Naming Processes
Processes are named with one carefully chosen verb and an object of
the verb. There is no subject. Name is not to include the word
"process". Each process should represent one function or action. If
there is an "and" in the name, you likely have more than one function
(and process). For example, get invoice update customer and create
Order
Processes should generally move from top to bottom and left to right.
External entities
External entities determine the system boundary. they are external to the
system being studied. They are often beyond the area of Influence of the
developer. These can represent another system or Subsystem. These go on
margins/edges of data flow diagram.
External entities are named with appropriate name.
Data Flow
Data flow represents the input (or Output) of data to (or from) a
Process ("data in motion"). Data flows only data, not control.
Represent the minimum essential data the process needs. Using
only the minimum essential data reduces the dependence between
processes. Data flows must begin and/or end at a process.
35
Data flows are always named. Name is not to include the word "data".
Should be given unique names. Names should be some identifying noun.
For example, order, payment, complaint.
Data stores
These are common link between data and process models. Only
processes may connect with data stores.
There can be two or more systems that share a data store. This can
occur in the case of one system updating the data store, while the
other system only accesses the data.
Data stores are named with an appropriate name, not to include the
word "file", Names should consist of plural nouns describing the
collection of data. Like customers, orders, and products.
36
DFD Showing rank calculation process of a university
Rank Status
Marks Comput Comput
e CGP e
CGP Rank
37
Making DFDs
Also, data flow diagrams have the objective of avoiding the cost of :
38
The procedure for producing a data flow diagram is to:
39
• Draw middle-level DFDs
Explode the composite processes
Balancing DFDs
• exactly the same data flows of the parent process enter and
leave the child diagram, or
• the same net contents from the parent process serve as the
Initial inputs and final outputs for the child diagram or
40
· Begin/end data flows with a bubble.
Number each process ( 1.0, 2.0, etc). Also name the process with a
verb that describes the information processing activity.
Name each data flow with a noun that describes the information
going into and out of a process. What goes in should be different
from what comes out,
Data stores, sources and destinations are also named with nouns.
Each lower level DFD must balance with its higher level DFD. This
means that no inputs and outputs are changed.
Think of data flow not control flow- Data flows are pathways for data.
Think about what data is needed to perform a process or update a data store.
A data flow diagram is not a flowchart and should not have loops or transfer
41
of control. Think about the data flows, data processes, and data storage that
are needed to move a data structure through a system.
Do not try to put everything you know on the data flow diagram. The
diagram should serve as index and outline. The index/outline will be
"fleshed out" in the data dictionary, data structure diagrams, and
procedure specification techniques.
42
43
E-R Diagrams
Description
Profi
t Rac
k
Cos
t STORE
Product
ID
Tot
cabni
al
t
Purchase Quantity
Sal
e
44
E-R Diagram of purchase
Description
Cost
Rack
Quantity
Purchase
Cabnit
Unit
Product ID
45
E-R Diagram of Sale
Description
Cost
Rack
Sale
Quantity
Cabnit
Unit
Product ID
46
E-R DIAGRAMS
Employee Loan
Physical Abstract
47
Entities are classified as independent or dependent (in some methodologies,
the terms used are strong and weak, respectively). An independent entity is
one, which does not rely on another entity for identification. A dependent
entity is one that relies on another entity for identification. An independent
entity exists on its own whereas dependent entity exists on the existence of
some other entity. For example take an organization scenario. Here
department is independent entity. Department manager is a dependent
entity. It exists for existing depts. There won’t be any department manager
for which there is no dept.
Some entity types may not have any key attributes of their own. These are
called weak entity types. Entities belonging to a weak entity type are
identified by being related to specific entities from another entity type in
combination with some of their attribute values. For example, take the
license entity. It can't exist unless it is related to a person entity.
Attributes
After you identify an entity, then you describe it in real terms, or through its
attributes. Attributes are basically properties of entity. We can use
attributes for identifying and expressing entities. For example, Dept entity
can have DeptName, DeptId, and
DeptManager as its attributes. A car entity can have modeino, brand name,
and color as its attributes.
Types of Attributes
48
• Key or non key attributes
• Required or optional
• Simple or composite
• Stored or derived
An entity usually has an attribute whose values are distinct for each
individual entity. This attribute uniquely identifies the individual entity.
Such an attribute is called a key attribute. For example, in the Employee
entity type, EmpNo is the key attribute since no two employees can have
same employee number. Similarly, for Product entity type, prodded is the
key attribute.
There may be a case when one simple attribute is not sufficient to identify
entities. Then a combination of attributes can solve this purpose. We can
form a group of more than one attribute and use this combination as a key
attribute. That is known as a composite key attribute. When identifying
attributes of entities, identifying, key attribute is very important.
Required or optional
49
here would be no employee having no employee no. Employee's spouse is
optional attribute because a employee may or may not have a spouse.
Attributes that can't be divided into subparts are called Simple or Atomic
attributes. For example Employee Number's a simple attribute. Age of a
person is a simple attribute.
Entity Types
An entity set is a set of entities of the same type that share the same
properties, or attributes. For example, all software engineers working in the
department involved in the Internet projects can be defined as the entity set
internet group. The individual entities that constitute a set are called
extension of the entity, set. Thus, all individual software engineers of in the
Internet projects are the extensions of the entity set IntemetGroup.
Entity sets don't need to be disjointed. For example, we can define an entity
set Employee. An employee may or may not be working on some Internet
projects. In Internet Group we will have some entries that are there in
Employee entity set. Therefore, entity sets Employee and Internet Group are
not disjoint.
A database usually contains groups of entities that are similar. For example, employees
of a company share the same attributes. However, every employee entity has its own
values for each attribute. An entity type defines a set of entities that have same
attributes. A name and a list of attributes describe each entity type.
50
An entity type is basically the schema or intension or structure for the set of
entities that share the same structure whereas the individual entities of a
particular entity type are collectively called entity set. 'I’ lie entity set is also
called the extension of the entity type.
51
52
Flow Chart
Start
menu Menu
Choices 1) 7)
2) 8)
3) 9)
4) H
5) E
6)
Input choice
If
No yes 1
choice=
)
1)
2 yes 2)
)
No
yes
If
choice=3 3)
) No =1)
53
No
If Yes
choice=4)
4)
No
Yes
If 5)
choice=5)
No
Yes
If 6)
choice=6)
No
Yes
If 7)
choice=7)
No
54
Yes
If 8)
choice=8)
No
If
choice=9) 9)
55
Yes
56
No
Yes H
If
choice=H
No
If
choice=E
Wrong
choice No
entere
d
Yes
Stop
Choice=1)
Information
If 57If
Wrong choice
choice
choice General
MEN entered = 2Enter
=1 Items
Choice Edibles
U
Yes
Yes
No
Enter product
Id-
Enter
Choice=2)
Description-
Enter rack No-
Output
DoEnter
you want
58addNo-
Cabnit
more records(y/n)
Enter
TotalUnit Cost- Men
Enter
Price=Sales Price-
Purchase u
Yes
No
59
Choice=3)
Yes Produ
If the record
matches ct
Sold
no
No In
Stock
Men
u
Choice=4)
60
Search a
Record
Enter the
choice for
search
If Search
choice=1 found Yes
)
No
If
choice=2 Search
Yes ) found
No
Men
u
61
Choice=5)
Delete
Records
Enter Delete
Option
If
Record
Yes choice=1
DeleteYes
)
Record
NOT
No
Found If
Record
choice=2
Delete
) Yes Yes
Men
No u
62
Choice=6)
View
Record
If View
choice=1 Sales
Yes ) record
No
If View
choice=2 Purchase
Yes
) record
View
If profit
No choice=3 record
)
Men
u No
63
Choice=8)
View Bar
Graph
Enter The
Option
If
View
choice=1
Bar
) Yes
Graph Of
Quantity
No
View
If
choice=2 Bar
) Graph Of
Yes Profit
Men
u No
64
Choice=9)
Retrieve
Record
View the
Last
Record
Me
nu
65
66
67
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
#include <dos.h>
#include <math.h>
#include <time.h>
#include<stdlib.h>
#include <bios.h>
void show_mouse();
int t();
void edit();
void infor();
void entry();
void display();
void search();
void search_id();
void search_name();
void del();
void deletion();
void deletion_id();
void print();
void help();
void eat();
void general();
void exit();
void seteefect(int, int);
void graph();
void bar(int inscor);
void graph2();
void bar2(int inscore2);
void report();
void report2();
void report3();
void pur();
void graph1();
void design();
void bbox();
void ventry(char t[],int);
struct shop
{
char desc[20];
int rack;
char ch;
int cabnit;
68
int quantity;
float sale;
char id[6];
float total;
float unit;
float cost;
float profit;
float bye;
int qty;
int ost;
int b;
};
void infor()
{
int sher;
clrscr();
textcolor(BLUE);
gotoxy(13,3);
printf("\xDB\xDB\xDB\xDB\xB2 INFORMATION ABOUT
PRODUCTS \xB2\xDB\xDB\xDB\xDB");
gotoxy(2,5);
printf("THIS SECTION IS TO TELL WHAT KIND OF PRODUCTS
ARE THERE IN STORE");
printf("\n\nENTER THE OPTION WHICH SUITS YOU.\n");
printf("\n\n1.EDIBLES.\n\n");
printf("\n2.GENERAL ITEMS.\n\n");
printf("\n\n\n\n\nOPTION:");
sher=toupper(getch());
//
switch(sher)
{
case '1':
eat();
break;
case '2':
general();
69
break;
default:
gotoxy(8,21);
cprintf("\awrong entry press any key to go main
menu..");
}
getche();
void eat()
{
clrscr();
printf("***************************************************
************\n");
printf(" ID : 123. JAM COMPANY : MITUCHELS
RACK NO 24 \n");
printf(" ID : 124. HONEY COMPANY : PAK PURE
RACK NO 25\n");
printf(" ID : 125. MILK COMPANY : HALEEB
RACK NO 26\n");
printf(" ID : 126. BREAD COMPANY : WONDER
RACK NO 27\n");
printf(" ID : 127. CHEES COMPANY : JUNAID
RACK NO 28\n");
printf(" ID : 128. JUICE COMPANY : SONS
RACK NO 29\n");
printf(" ID : 129. PEPSI COMPANY : MAJEED
RACK NO 30 \n");
printf(" ID : 130. BUTTER COMPANY : JAFFAR
RACK NO 31 \n");
printf(" ID : 131. ICECREAM COMPANY : POLKA
FREEZER 32 \n");
printf("***************************************************
***********\n\n");
printf("Press any key to continue......");
getche();
clrscr();
printf(" ID : 133. MILO COMPANY : MITUCHELS
RACK NO 24 \n");
printf(" ID : 134. KEY BRAN COMPANY : PAK PURE
RACK NO 25\n");
printf(" ID : 135. TANG COMPANY : HALEEB
RACK NO 26\n");
70
printf(" ID : 136. ALWAYS COMPANY : WONDER
RACK NO 27\n");
printf(" ID : 327. PEPPARS COMPANY : JUNAID
RACK NO 28\n");
printf(" ID : 138. JHERBAL COMPANY : SONS
RACK NO 29\n");
printf(" ID : 139. PEPSI COMPANY : MAJEED
RACK NO 30 \n");
printf(" ID : 130. ORAGD COMPANY : JAFFAR
RACK NO 31 \n");
printf(" ID : 131. ICECREAM COMPANY : POLKA
FREEZER 32 \n");
printf("***************************************************
***********\n");
printf(" ID : 143. SHAMPO COMPANY : MITUCHELS
RACK NO 24 \n");
printf(" ID : 144. AGRI COMPANY : PAK PURE
RACK NO 25\n");
printf(" ID : 145. TIMO COMPANY : HALEEB
RACK NO 26\n");
printf(" ID : 146. WASHSN COMPANY : WONDER
RACK NO 27\n");
printf(" ID : 147. LACE COMPANY : JUNAID
RACK NO 28\n");
printf(" ID : 428. YARDLY COMPANY : SONS
RACK NO 29\n");
printf(" ID : 149. MUSK COMPANY : MAJEED
RACK NO 30 \n");
printf(" ID : 140. BUTTER COMPANY : JAFFAR
RACK NO 31 \n");
printf(" ID : 141. IMPERIAL COMPANY : POLKA
FREEZER 32 \n");
printf("***************************************************
***********\n");
printf("\n\nPress enter to return to main menu");
}
void general()
{
clrscr();
printf("***************************************************
************\n");
printf(" ID : 153. DETOL COMPANY : MITUCHELS
RACK NO 24 \n");
71
printf(" ID : 154. SHAMPO COMPANY : PAK PURE
RACK NO 25\n");
printf(" ID : 155. FINERRE COMPANY : HALEEB
RACK NO 26\n");
printf(" ID : 156. CURTIS COMPANY : WONDER
RACK NO 27\n");
printf(" ID : 157. NIVKA COMPANY : JUNAID
RACK NO 28\n");
printf(" ID : 158. NIVCA COMPANY : SONS
RACK NO 29\n");
printf(" ID : 159. DETOL COMPANY : MAJEED
RACK NO 30 \n");
printf(" ID : 150. BUTTER COMPANY : JAFFAR
RACK NO 31 \n");
printf(" ID : 151. SHAVE COMPANY : POLKA
FREEZER 32 \n");
printf("***************************************************
************\n\n");
printf("Press any key to continue......");
getche();
clrscr();
printf(" ID : 163. ADDIS COMPANY : MITUCHELS
RACK NO 24 \n");
printf(" ID : 164. SKIN COMPANY : PAK PURE
RACK NO 25\n");
printf(" ID : 165. MAX COMPANY : HALEEB
RACK NO 26\n");
printf(" ID : 166. BRESCO COMPANY : WONDER
RACK NO 27\n");
printf(" ID : 167. ZABIT COMPANY : JUNAID
RACK NO 28\n");
printf(" ID : 168. COPEX COMPANY : SONS
RACK NO 29\n");
printf(" ID : 169. SOAP COMPANY : MAJEED
RACK NO 30 \n");
printf(" ID : 160. PAMOLI COMPANY : JAFFAR
RACK NO 31 \n");
printf(" ID : 161. AVA COMPANY : POLKA
FREEZER 32 \n");
printf("***************************************************
************\n");
printf(" ID : 163. CAMY COMPANY : MITUCHELS
RACK NO 24 \n");
printf(" ID : 164. SAFE COMPANY : PAK PURE
RACK NO 25\n");
72
printf(" ID : 165. GUARD COMPANY : HALEEB
RACK NO 26\n");
printf(" ID : 166. DOVE COMPANY : WONDER
RACK NO 27\n");
printf(" ID : 167. REXONA COMPANY : JUNAID
RACK NO 28\n");
printf(" ID : 168. TOUCNME COMPANY : SONS
RACK NO 29\n");
printf(" ID : 169. FORHANS COMPANY : MAJEED
RACK NO 30 \n");
printf(" ID : 160. SIGNAL2 COMPANY : JAFFAR
RACK NO 31 \n");
printf(" ID : 161. CLOSEUP COMPANY : POLKA
FREEZER 32 \n");
printf("***************************************************
************\n");
printf("\n\nPress enter to return to main menu");
///////////////////////////////
time ///////////////////////////
int t(void)
{
time_t t;
time(&t);
// clrscr();
gotoxy(15,21);
printf("Date and time: %s\n", ctime(&t));
return 0;
}
/////////////////////////////////////
validation //////////////////////////
void ventry(char t[],int code)
{
int i=0;
if(code==0)
{
73
}
}
else if(code==1)
{
while((t[i]=getch())!='\r' && i<10)
if((t[i]>=48 && t[i]<=57) || t[i]==46 || t[i]==8 )
{ printf("%c",t[i]);
i++;
}
}
t[i]='\0';
}
/******************************data
entry***********************************/
void entry()
{
char ch;
clrscr();
ptr=fopen("shop.dat","a+b");
ch='y';
while(ch=='y')
{
clrscr();
design();
textcolor(16);
t();
gotoxy(14,3);
cprintf("\xDB\xDB\xDB\xDB\xDB\xB2 PURSHASE
\xB2\xDB\xDB\xDB\xDB\xDB ");
{
gotoxy(7,5);
cprintf("\xDB\xDB\xB2 ENTER PRODUCT ID : ");
ventry(temp.id,1);
//
flushall();
gotoxy(7,7);
cprintf("\xDB\xDB\xB2 ENTER DESCRIPTION : ");
ventry(temp.desc,0);
flushall();
gotoxy(7,9);
cprintf("\xDB\xDB\xB2 ENTER RACK NO : ");
ventry(a,1);
74
temp.rack= atoi(a);
flushall();
gotoxy(7,11);
cprintf("\xDB\xDB\xB2 ENTER CABNIT NO : ");
ventry(a,1);
temp.cabnit= atoi(a);
//
flushall();
gotoxy(7,13);
///////////////////////
cprintf("\xDB\xDB\xB2 ENTER UNIT COST :$ ");
ventry(a,1);
temp.unit= atof(a);
flushall();
gotoxy(7,15);
cprintf("\xDB\xDB\xB2 ENTER SALE PRICE :$ ");
ventry(a,1);
temp.sale= atof(a);
flushall();
gotoxy(7,17);
cprintf("\xDB\xDB\xB2 ENTER QUANTITY : ");
ventry(a,1);
temp.quantity= atoi(a);
flushall();
gotoxy(7,18);
cprintf("=====================================");
temp.total=temp.quantity*temp.sale;
textcolor(10);
gotoxy(10,20);
cprintf("\xB2\xDB\xB2 TOTAL PRICE = $
%.2f",temp.total);
temp.cost=(temp.unit*temp.quantity);
gotoxy(40,20);
cprintf("\xDB\xB2 TOTAL COST = $ %.2f",temp.cost);
}
fwrite(&temp,sizeof(temp),1,ptr);
textcolor(10);
gotoxy(10,23);
cprintf("More entries [y/n]");
ch=getche();
75
}
fclose(ptr);
/*****************************data
retreivel********************************/
void display()
{
clrscr();
ptr=fopen("shop.dat","rb");
while ((fread(&temp,sizeof(temp),1,ptr))==1)
{
gotoxy(22,3);
printf("\xDB\xDB\xDB\xB2\xB2 RETRIEVE RECORD
\xB2\xB2\xDB\xDB\xDB");
gotoxy(18,5);
printf("\xDB\xDB\xB2 DESCRIPTION : %s",temp.desc);
gotoxy(18,7);
printf("\xDB\xDB\xB2 ID NUMBER : %s",temp.id);
gotoxy(18,9);
printf("\xDB\xDB\xB2 RACK NO : %d",temp.rack);
gotoxy(18,11);
printf("\xDB\xDB\xB2 CABNIT NO : %d",temp.cabnit);
gotoxy(18,13);
printf("\xDb\xDB\xB2 UNIT COST :$ %.2f",temp.unit);
gotoxy(18,15);
printf("\xDB\xDB\xB2 SALE PRICE : $
%.2f",temp.sale);
gotoxy(18,17);
printf("\xDB\xDB\xB2 QUANTITY :
%d",temp.quantity);
gotoxy(16,18);
printf("===================================");
gotoxy(16,20);
printf("\xDB\xDB\xB2 TOTAL PRICE : $
%.2f",temp.total);
gotoxy(47,20);
printf("\xDB\xB2 TOTAL COST : $ %.2f",temp.cost);
gotoxy(20,23);
printf("Press Enter to see next if any or exit ...");
getche();
76
clrscr();
fclose(ptr);
//
}
/*******************************data
search*******************************/
void search()
{
int sh;
clrscr();
design();
gotoxy(17,6);
printf("\xDB\xDB\xB2 Two options available to
search \xB2\xDB\xDB");
gotoxy(15,9);
printf("[ 1 ] - Search by ID number .");
gotoxy(15,11);
printf("[ 2 ] - Search by Description .");
gotoxy(17,15);
printf("Enter your choice:: ");
sh=toupper(getch());
switch(sh)
{
case '1':
search_id();
break;
case '2':
search_name();
break;
default:
gotoxy(18,18);
printf("\a\xDB\xDB wrong entry try again");
getch();
}
getche();
77
/*****************************search by
id*********************************/
void search_id()
{
int flag=0;
char lkf[20];
clrscr();
ptr=fopen("shop.dat","rb");
design();
gotoxy(13,4);
printf("\xDB\xDB\xB2 Enter id to be searched:");
scanf("%s",&lkf);
while((!flag)&&(fread(&temp,sizeof(temp),1,ptr))==1)
{
if(strcmp(temp.id,lkf)==0)
flag=1;
}
if(flag)
{
gotoxy(18,6);
printf("Product ID : %s",temp.id);
gotoxy(18,8);
printf("Description : %s",temp.desc);
gotoxy(18,10);
printf("Rack no : %d",temp.rack);
gotoxy(18,12);
printf("Cabnit : %d",temp.cabnit);
gotoxy(18,14);
printf("Sale price :$ %.2f",temp.sale);
gotoxy(18,16);
printf("Quantity : %d",temp.quantity);
gotoxy(16,17);
printf("============================");
gotoxy(18,19);
printf(" Total :$ %.2f",temp.total);
}
else
printf("Record not found!");
fclose(ptr);
}
78
/*****************************search by
name******************************/
void search_name()
{
int flag=0;
char lkf[20];
clrscr();
ptr=fopen("shop.dat","rb");
design();
gotoxy(13,4);
printf("\xDB\xDB\xB2 Enter description to be
searched:");
scanf("%s",&lkf);
while((!flag)&&(fread(&temp,sizeof(temp),1,ptr))==1)
{
if(strcmp(temp.desc,lkf)==0)
flag=1;
}
if(flag)
{
gotoxy(18,6);
printf("Product ID : %s",temp.id);
gotoxy(18,8);
printf("Description : %s",temp.desc);
gotoxy(18,10);
printf("Rack no : %d",temp.rack);
gotoxy(18,12);
printf("Cabnit : %d",temp.cabnit);
gotoxy(18,14);
printf("Sale price :$ %.2f",temp.sale);
gotoxy(18,16);
printf("Quantity : %d",temp.quantity);
gotoxy(16,17);
printf("============================");
gotoxy(18,19);
printf(" Total :$ %.2f",temp.total);
}
else
printf("Record not found!");
fclose(ptr);
}
79
/******************************data
deletion*****************************/
void deletion()
{
int j,n,i;
char tar[30];
int count=0;
ptr = fopen("shop.dat","rb");
clrscr();
design();
gotoxy(17,10);
printf("\xDB\xDB Enter Description to be
deleted:");
scanf("%s",&tar);
j=0;
while((fread(&temp,sizeof(temp),1,ptr))==1)
{
if((strcmp(temp.desc,tar)<0) ||
(strcmp(temp.desc,tar)>0))
{
x[j] = temp;
j++;
}
else
{
count++;
}
}
if (count==0)
{
clrscr();
design();
gotoxy(30,10);
printf("\xDB\xDB Record Not Found");
gotoxy(17,23);
printf("Press Enter to go to MAIN MENU .....");
getch();
return;
}
fclose(ptr);
n = j;
clrscr();
ptr=fopen("shop.dat","wb");
80
for(i=0; i<n; i++)
fwrite(&x[i],sizeof(x[i]),1,ptr);
fclose(ptr);
clrscr();
design();
gotoxy(20,10);
printf("Record has been deleted");
gotoxy(20,12);
printf("Check it by going to the displayed
record");
gotoxy(17,23);
printf("Press Enter to go to MAIN MENU ......");
getch();
}
/******************************data
print*********************************/
void print()
{
clrscr();
putc('\n',stdprn);
fputs("\n\t\t\tREPRT OF SALES",stdprn);
putc('\n',stdprn);
fputs("===========================",stdprn);
putc('\n',stdprn);
putc('\n',stdprn);
fputs("PRODUCT ID. NAME. SALE PRICE. QUANTITY.
TOTAL PRICE",stdprn);
fputs("==================================================
=================",stdprn);
putc('\n',stdprn);
putc('\n',stdprn);
ptr=fopen("shop.dat","rb");
while( (fread(&temp,sizeof(temp),1,stdprn))==1)
{
fprintf(stdprn," %s",temp.id);
fprintf(stdprn,"\t%s",temp.desc);
fprintf(stdprn,"\t%.2f",temp.sale);
fprintf(stdprn,"\t%ld\n",temp.quantity);
fprintf(stdprn,"\t%.2f",temp.total);
}
fclose(ptr);
81
}
/
******************************help*************************
**************/
void help()
{
clrscr();
design();
textcolor(GREEN);
gotoxy(20,4);
cprintf("\xDB\xDB\xDB\xDB\xB2 HELP ABOUT THE PROGRAM
\xB2\xDB\xDB\xDB\xDB");
gotoxy(4,6);
cprintf(" [ 2 ] - ENTER RECORDS : THIS OPTION ALLOWS
THE USER TO ENTER NEW ");
gotoxy(30,7);
cprintf("RECORDS. USER ENTERS PRODUCT ID,
DESCRIPTION,");
gotoxy(30,8);
cprintf("QUANTITY AND UNIT PRICE. THE PROGRAMM
CALCULATES");
gotoxy(30,9);
cprintf("TOTAL PRICE AND DISPLAYS ON THE SCREEN.");
gotoxy(4,11);
cprintf(" [ 3 ] - ENTER SALES : THIS OPTION ALLOWS
THE USER TO SEE PREVIOUS ");
gotoxy(30,12);
cprintf("SALE RECORDS.");
gotoxy(4,14);
cprintf(" [ 4 ] - SEARCH PURCHASE : THIS OPTION ALLOWS
THE USER TO SEARCH SPECIFIC");
gotoxy(30,15);
cprintf("RECORD BY ENTERING ID OR 'DESCRIPTION'");
gotoxy(4,17);
cprintf(" [ 5 ] - DELETE PURCHASE : THIS OPTION ALLOWS
THE USER TO DELETE A SPECIFIC");
gotoxy(30,18);
cprintf("RECORD BY ENTERING ITS 'DESCRIPTION' OR ID");
gotoxy(6,23);
cprintf("Press any key to continue .............");
getche();
clrscr();
design();
textcolor(GREEN);
82
gotoxy(4,5);
cprintf(" [ 6 ] - VIEW REPORT : THIS OPTION ALLOWS
THE USER TO PRINT PREVIOUS");
gotoxy(30,6);
cprintf("SALE RECORDS ON PRINTER");
gotoxy(4,8);
cprintf(" [ 7 ] - PRINT RECORDS : THIS OPTION ALLOWS
THE USER TO PRINT RECORDS");
gotoxy(30,9);
cprintf("OM PRINTER.");
gotoxy(4,11);
cprintf(" [ 8 ] - VIEW GRAPH : THIS OPTION ALLOWS
THE USER TO VIEW GRAPH ");
gotoxy(30,12);
cprintf("OF QUANTITY.");
gotoxy(10,23);
printf("Press any key to go to the MAIN
MENU ........");
getche();
}
/***************************main
menu*************************************/
menu()
{
int x;
do{
{
clrscr();
design();
t();
textcolor(BLUE);
gotoxy(24,3);
cprintf("\xDB\xDB\xDB\xDB\xB2 DEPARTMANTAL STORE
\xB2\xDB\xDB\xDB\xDB");
gotoxy(3,4);
cprintf("--------------------------------------------------
------------------------");
gotoxy(35,5);
cprintf("MAIN MENU");
gotoxy(26,8);
cprintf(" 1 - INFORMATION ABOUT PRODUCTS
");
gotoxy(26,9);
83
cprintf(" 2 - ENTER PURCHASE RECORDS
");
gotoxy(26,10);
cprintf(" 3 - ENTER PRODUCTS TO BE SOLD
");
gotoxy(26,11);
cprintf(" 4 - SEARCH FOR RECORD
");
gotoxy(26,12);
cprintf(" 5 - DELETE RECORD FROM STORE DATABASE
");
gotoxy(26,13);
cprintf(" 6 - VIEW SALES , PURCHASE & PROFIT REPORT
");
gotoxy(26,14);
cprintf(" 7 - PRINT RECORDS
");
gotoxy(26,15);
cprintf(" 8 - BAR GRAPH OF QUANTITY / PROFIT
");
gotoxy(26,16);
cprintf(" 9 - RETRIEVE INFORMATION ");
gotoxy(26,17);
cprintf(" H - HELP
");
gotoxy(26,18);
cprintf(" E - EXIT
");
gotoxy(26,23);
//
cprintf("ENTER YOUR CHOICE :: ");
gotoxy(47,23);
x=toupper(getch());
switch(x)
{
case '1':
infor();
break;
case '2':
entry();
break;
case '3':
edit();
break;
84
case '4':
search();
break;
case '5':
del();
break;
case '6':
report2();
break;
case '7':
print();
break;
case'8':
graph1();
break;
case '9':
display();
break;
default:
clrscr();
design();
gotoxy(17,12);
printf("\a\xDB\xB2 WRONG ENTRY : PRESS ANY KEY AND
TRY AGAIN");
getche();
}
}
}while((x!='e')||(x!='E'));
return x;
}
void main()
85
{
textbackground(14);
show_mouse();
menu();
}
/************************************* graph
***********************************/
void graph()
{
int inscor=1;
char ch;
clrscr();
design();
gotoxy(20,23);
printf("Press enter to go to MAIN MENU .....");
textcolor(10);
gotoxy(15,4);
cprintf("************* GRAPH OF PRODUCT QUANTITY
*************");
textcolor(14);
gotoxy(3,5);
cprintf(" PRODUCT NAME");
ptr=fopen("shop.dat","rb");
while((fread(&temp,sizeof(temp),1,ptr))==1)
{
fclose(ptr);
getche();
}
void bar()
{
int j;
for(j=1;j<=temp.quantity;j++)
printf("\xDB");
printf(" %d",temp.quantity);
printf("\n");
}
/*********************************** view report
****************************/
void report()
{
86
char ch;
clrscr();
design();
gotoxy(20,23);
printf("Press Enter to go to MAIN MENU ........");
textcolor(GREEN);
gotoxy(25,4);
cprintf("\xDB\xDB\xDB\xDB\xDB\xB2 VIEW OF SALES
\xB2\xDB\xDB\xDB\xDB\xDB");
textcolor(RED);
gotoxy(4,7);
cprintf("PRODUCT ID. NAME. SALE PRICE.
QUANTITY. TOTAL PRICE");
gotoxy(4,9);
printf("=================================================
=======================");
ptr=fopen("shop.dat","rb");
while((fread(&temp,sizeof(temp),1,ptr))==1)
{
//
printf("\n \xBA %s\t",temp.id);
printf("\t%s",temp.desc);
printf("\t\t$%.2f",temp.sale);
// printf("\t\t%d",temp.qty);
printf("\t\t%d",temp.quantity);
// printf("\t\t%d",temp.bye);
printf("\t\t $%.2f",temp.total);
getche();
}
void seteffect(int b, int f)
{
clrscr();
textbackground(b);
textcolor(f);
}
void pur()
{
char ch;
87
clrscr();
design();
show_mouse();
gotoxy(20,23);
printf("Press Enter to go to MAIN MENU ...........");
textcolor(GREEN);
gotoxy(25,4);
cprintf("\xDB\xDB\xDB\xDB\xDB\xB2 VIEW OF PURCHASES
\xB2\xDB\xDB\xDB\xDB\xDB");
textcolor(RED);
gotoxy(4,7);
cprintf("PRODUCT ID. NAME. UNIT PRICE.
QUANTITY. TOTAL COST");
gotoxy(4,9);
printf("=================================================
=======================");
ptr=fopen("shop.dat","rb");
while((fread(&temp,sizeof(temp),1,ptr))==1)
{
//
printf("\n \xBA %s\t\t",temp.id);
printf(" %s",temp.desc);
printf("\t\t4%.2f",temp.unit);
printf("\t\t%d",temp.quantity);
printf("\t\t $%.2f",temp.cost);
}
getche();
}
void graph2()
{
int inscor2=1;
char ch;
clrscr();
design();
gotoxy(20,23);
printf("Pres Enter to go to MAIN MENU ...........");
textcolor(10);
gotoxy(15,4);
cprintf("************* GRAPH OF PROFIT *************");
textcolor(14);
gotoxy(4,5);
88
cprintf("PRODUCT NAME");
ptr=fopen("shop.dat","rb");
while((fread(&temp,sizeof(temp),1,ptr))==1)
{
fclose(ptr);
getche();
}
void bar2()
{
int j;
temp.profit=(temp.total-temp.cost);
//
for(j=1;j<=temp.profit;j++)
printf("\xDB");
printf(" %.1f$",temp.profit);
printf("\n");
}
void graph1()
{
int sher;
clrscr();
textcolor(WHITE);
gotoxy(24,3);
printf("\xDB\xDB\xDB\xDB\xB2 BAR GRAPH
\xB2\xDB\xDB\xDB\xDB");
gotoxy(10,5);
printf("THIS SECTION IS TO show the graph of quantity
and profit ");
printf("\n\n\t ********* ENTER THE OPTION WHICH
SUITS YOU. *******\n");
printf("\n\n\t\xDB\xDB\xB2 1.QUANTITY.\n\n");
printf("\n\t\xDB\xDB\xB2 2.PROFIT.\n");
printf("\n\n\n\t\t\xDB\xDB\xB2 OPTION:");
sher=toupper(getch());
switch(sher)
89
{
case '1':
graph();
break;
case '2':
graph2();
break;
default:
gotoxy(9,20);
textcolor(RED);
cprintf("\a\xDB\xB2 WRONG ENTRY : PRESS ENTER TO GO
TO MAIN MENU... ");
getche();
}
}
/************************** report of profit
**********************/
void report3()
{
char ch;
clrscr();
design();
gotoxy(20,23);
printf("Press Enter to go to MAIN MENU .... ");
textcolor(GREEN);
gotoxy(25,4);
cprintf("\xDB\xDB\xDB\xDB\xDB\xB2 VIEW OF PROFIT
\xB2\xDB\xDB\xDB\xDB\xDB");
textcolor(RED);
gotoxy(4,7);
cprintf("PRODUCT ID. DESCRIPTION. QUANTITY.
PROFIT.");
gotoxy(4,9);
printf("=================================================
===========");
ptr=fopen("shop.dat","rb");
while((fread(&temp,sizeof(temp),1,ptr))==1)
{
90
temp.profit=(temp.total-temp.cost);
printf("\t\t $%.2f",temp.profit);
}
getche();
}
void report2()
{
int sher;
clrscr();
bbox();
textcolor(WHITE);
gotoxy(21,3);
printf("\xDB\xDB\xDB\xDB\xB2 REPORT OF SALES /
PURCHASE \xB2\xDB\xDB\xDB\xDB");
gotoxy(5,5);
printf("\tTHIS SECTION IS VIEWING SALES, PURCHASE and
PROFIT REPORTS ");
gotoxy(10,7);
printf(" ********* ENTER THE OPTION WHICH SUITS
YOU. **********\n");
gotoxy(12,10);
printf("\xDB\xDB\xB2 1.SALES.");
gotoxy(12,12);
printf("\xDB\xDB\xB2 2.PURCHASE.");
gotoxy(12,14);
printf("\xDB\xDB\xB2 3.PROFIT.");
gotoxy(14,17);
printf("\xDB\xDB\xB2 OPTION:");
sher=toupper(getch());
switch(sher)
{
case '1':
report();
break;
case '2':
pur();
break;
91
case '3':
report3();
break;
default:
gotoxy(9,20);
textcolor(RED);
cprintf("\a\xDB\xB2 WRONG ENTRY : PRESS ENTER TO GO
TO MAIN MENU....");
getche();
void design()
{
int i;
clrscr();
textcolor(14);
/****************************** table design
*********************/
gotoxy(2,2);
cprintf("\xC9");
gotoxy(3,2);
for(i=1;i<=74;i++)
cprintf("\xCD");
gotoxy(77,2);
cprintf("\xBB");
gotoxy(2,3);
cprintf("\xBA");gotoxy(2,4);cprintf("\xBA");gotoxy(2,5);cpr
intf("\xBA");
gotoxy(2,6);cprintf("\xBA");gotoxy(2,7);cprintf("\xBA");got
oxy(2,8);cprintf("\xBA");
gotoxy(2,9);cprintf("\xBA");gotoxy(2,10);cprintf("\xBA");go
toxy(2,11);cprintf("\xBA");gotoxy(2,12);cprintf("\xBA");
gotoxy(2,13);cprintf("\xBA");gotoxy(2,14);cprintf("\xBA");g
otoxy(2,15);cprintf("\xBA");gotoxy(2,16);cprintf("\xBA");
92
gotoxy(2,17);cprintf("\xBA");gotoxy(2,18);cprintf("\xBA");g
otoxy(2,22);cprintf("\xCC");
gotoxy(2,19);cprintf("\xBA");gotoxy(2,20);cprintf("\xBA");g
otoxy(2,21);cprintf("\xBA");gotoxy(2,24);cprintf("\xC8");
gotoxy(2,23);cprintf("\xBA");
gotoxy(3,24);
for(i=1;i<=74;i++)
cprintf("\xCD");
gotoxy(77,18);cprintf("\xBA");gotoxy(77,19);cprintf("\xBA")
;gotoxy(77,20);cprintf("\xBA");gotoxy(77,21);cprintf("\xBA"
);gotoxy(77,24);cprintf("\xBC");
gotoxy(77,23);
cprintf("\xBA");
gotoxy(3,22);
for(i=1;i<=74;i++)
cprintf("\xCD");
gotoxy(77,22);
cprintf("\xB9");
//*****************
gotoxy(77,3);
cprintf("\xBA");gotoxy(77,4);cprintf("\xBA");gotoxy(77,5);c
printf("\xBA");
gotoxy(77,6);cprintf("\xBA");gotoxy(77,7);cprintf("\xBA");g
otoxy(77,8);cprintf("\xBA");
gotoxy(77,9);cprintf("\xBA");gotoxy(77,10);cprintf("\xBA");
gotoxy(77,11);cprintf("\xBA");gotoxy(77,12);cprintf("\xBA");
gotoxy(77,13);cprintf("\xBA");gotoxy(77,14);cprintf("\xBA")
;gotoxy(77,15);cprintf("\xBA");gotoxy(77,16);cprintf("\xBA"
);
gotoxy(77,17);cprintf("\xBA");
textcolor(RED);
//
void bbox()
{
int c,r;
for(c=1;c<=79;c++)
{
93
gotoxy(c,1);
printf("ß");
gotoxy(c,25);
printf("ß");
}
for(r=1;r<=24;r++)
{
gotoxy(1,r);
printf("Û");
gotoxy(79,r);
printf("Û");
}
}
////////////////////////////////// by id
deletion ////////////////////////////
void deletion_id()
{
int j,n,i;
char tar[30];
int count=0;
ptr = fopen("shop.dat","rb");
clrscr();
design();
gotoxy(15,8);
printf("\xDB\xDB Enter ID be deleted:");
scanf("%s",&tar);
j=0;
while((fread(&temp,sizeof(temp),1,ptr))==1)
{
if((strcmp(temp.id,tar)<0) ||
(strcmp(temp.id,tar)>0))
{
x[j] = temp;
j++;
}
else
{
count++;
}
}
if (count==0)
{
94
clrscr();
design();
gotoxy(30,10);
printf("\xDB\xDB Record Not Found");
gotoxy(17,23);
printf("Press Enter to go to MAIN MENU ......");
getch();
return;
}
fclose(ptr);
n = j;
clrscr();
ptr=fopen("shop.dat","wb");
for(i=0; i<n; i++)
fwrite(&x[i],sizeof(x[i]),1,ptr);
fclose(ptr);
clrscr();
design();
gotoxy(15,10);
printf("Record has been deleted");
gotoxy(15,12);
printf("Check it by going to the displayed
record");
gotoxy(17,23);
printf("Press Enter to go to MAIN MENU ......");
getch();
void del()
{
int sh;
clrscr();
design();
gotoxy(17,6);
printf("\xDB\xDB\xB2 Two options available to delete
\xB2\xDB\xDB");
gotoxy(16,9);
printf("[ 1 ] - Delete by ID number ");
gotoxy(16,11);
printf("[ 2 ] - Delete by Description ");
gotoxy(18,15);
printf("Enter your choice :: ");
95
sh=toupper(getch());
switch(sh)
{
case '1':
deletion_id();
break;
case '2':
deletion();
break;
default:
gotoxy(18,18);
printf("\a\xDB\xDB Wrong entry ");
gotoxy(17,23);
printf("Press Enter to go to MAIN MENU .....");
getch();
}
getche();
///////////////////////////////////// update
record //////////////////////
void edit()
{
int j,n,i,a;
float b;
char tar[30],ch;
int count=0;
ch='y';
while(ch=='y')
{
ptr = fopen("shop.dat","rb");
clrscr();
design();
gotoxy(15,9);
printf("\xDB\xDB ENTER ID OF THE PRODUCT TO BE
SOLD:");
scanf("%s",&tar);
j=0;
while((fread(&temp,sizeof(temp),1,ptr))==1)
{
96
if((strcmp(temp.id,tar)<0) ||
(strcmp(temp.id,tar)>0))
{
x[j] = temp;
j++;
}
else
{
design();
gotoxy(8,7);
printf("\xDB\xDB Description =
%s",temp.desc);
gotoxy(8,9);
printf("\xDB\xDB Quantity in stock =
%d",temp.quantity);
gotoxy(8,11);
printf("\xDB\xDB Sales price =
%.2f",temp.sale);
gotoxy(8,13);
printf("\xDB\xDB Quantity want to sale : ");
scanf("%d",&a);
x[j]=temp;
x[j].quantity=(x[j].quantity-a);
x[j].total=(x[j].quantity*temp.sale);
x[j].cost=(x[j].quantity*temp.unit);
x[j].bye=(x[j].sale*a);
b=x[j].bye;
x[j].qty=a;
j++;
count++;
}
}
if (count==0)
{
clrscr();
design();
gotoxy(33,10);
printf("\a\xDB\xDB\xB2 Not in stock");
getch();
return;
}
fclose(ptr);
n = j;
clrscr();
ptr=fopen("shop.dat","wb");
97
for(i=0; i<n; i++)
fwrite(&x[i],sizeof(x[i]),1,ptr);
fclose(ptr);
clrscr();
design();
gotoxy(8,9);
printf("\xDB\xDB Price paid by customer =
%.2f",b);
gotoxy(8,11);
printf("\xDB\xDB Quantity sold = %d",a);
getch();
printf("more enteries=(y/n)");
ch=getche();
}
}
///////////////////////////////////
end ///////////////////////////
void show_mouse(void)
{
union REGS in, out;
in.x.ax = 0x1;
int86(0x33, &in, &out);
}
98
99
OUTPUT
--------------------------------------------------------------------------
DEPARTMANTAL STORE
--------------------------------------------------------------------------
MAIN MENU
--------------------------------------------------------------------------
ENTER YOUR CHOICE ::
--------------------------------------------------------------------------
1.EDIBLES.
2.GENERAL ITEMS.
OPTION:
100
Figure 1 Information about products
PURSHASE
ENTER CABNIT NO : 5
ENTER QUANTITY : 3
=====================================
101
Figure 2 Enter purchase records
SALE
Quantity sold =3
102
Figure 3 Enter products to be sold
103
SEARCH RECORD
[ 2 ] - Search by Description .
Enter id to be searched:126
Product ID : 126
Description : shampoo
Rack no : 24
Cabnit : 5
Quantity : 0
============================
Total :$ 0.00
104
Figure 4 Search for record
105
DELETE RECORD
[ 1 ] - Delete by ID number
[ 2 ] - Delete by Description
--------------------------------------------------------------------------
Press Enter to go to MAIN MENU ......
--------------------------------------------------------------------------
106
Figure 5 Delete record from store data base
107
REPORT OF SALES / PURCHASE
1.SALES.
2.PURCHASE.
3.PROFIT.
OPTION:
VIEW OF SALES
========================================================
--------------------------------------------------------------------------
Press Enter to go to MAIN MENU ........
108
Figure 6 View sales, purchase and profit report
109
BAR GRAPH
1.QUANTITY.
2.PROFIT.
OPTION:
shampoo :2
110
Figure 7 Bar graph of quantity / profit
111
RETRIEVE RECORD
DESCRIPTION :
ID NUMBER :
RACK NO : 0
CABNIT NO : 0
QUANTITY : 0
===================================
112
Figure 8 Retrieve information
113
HELP ABOUT THE PROGRAM
--------------------------------------------------------------------------
Press any key to continue .............
--------------------------------------------------------------------------
--------------------------------------------------------------------------
Press any key to go to the MAIN MENU ........
--------------------------------------------------------------------------
114
Figure 9 Help
115
116
TESTING
“Testing is the process of executing a program with the intent of finding
errors” in software development process, errors can be injected at any stages
during development. There are various techniques that are used for detecting and
eliminating errors but no method is perfect because most of the verification
methods of earlier phases are manual.
During testing, the program to be tested is executed with a test case is
evaluate to determine if the program is performing as expected. Testing is a set of
activities that can be planned in advance and conducted systematically. It’s a
process of analyzing a software item to detect the difference between existing and
required conditions (i.e. bugs) and to evaluate the features of the software items.
Test case designs are constructed for each path and for all logical decisions,
and boundary values conditions. There are four paths in the process flow and
therefore four test case designs would be built to test path processing. A test case
will test whether logical decisions are made through condition testing and on that
result whether control of process moves to the appropriate branch.
The white-box testing can be applied to the operations defined for a class
basis path, loop testing, or data flow techniques can help to ensure that every
statement in an operation has been tested. However, the concise structure of many
class operations causes some to argue that the effort applied to white box testing
might be better redirected to tests at a class level.
Black box testing methods are as appropriate for Object Oriented System
as they are for Systems developed using conventional Software engineering
methods.
UNIT TESTING
117
Interface
Local data structures
Module Boundary Conditions
Independent paths
Error handling paths
Test Codes
White box testing, sometimes called glass box testing, uses the flow and
control structure of the process to derive the test case design white box testing is
carried out to test whether .
118
a) All paths in a process are correctly operational.
b) All logical decisions are executed with true or false conditions.
c) All loops are executed with their limit values tested.
d) To ascertain whether input data structure specifications are tested
and then used for other processing. In order to handle complexities of unit level
processing, test case designs are built after drawing process flow charts and flow
graphs.
Logical
Sequence 7
Sta Sequence
rt
Loop
7
1 Logical
Design If 7
1
Branching on
2 Process 7 7 condition
stop
7 3 Logical design 7 7
1 Unit
7
Terminal case
4 5 While
7 7 7 7
6
Back to the next 7 7
Element of data
8 In a loop until.
stop 7
Stop
119
BLACK BOX TESTING
CONCLUSION
120
121
122
BIBLIOGRAPHY
123
WEBSITES
http://www.syncfusion.com/FAQ/winForm/
http://www.codeproject.com
http://msdn.microsoft.com
http://www.google.com
http://www.codehelper.com
www.tatamcgrawhill.com
124
C's Standard Libraries
Objectives
125
long ftell(FILE *stream)
void rewind(FILE *stream)
int fgetpos(FILE *stream, fpos_t *ptr)
int fsetpos(FILE *stream, const fpos_t *ptr)
void clearerr(FILE *stream)
int feof(FILE *stream)
int ferror(FILE *stream)
void perror(const char *s)
126
atan2(x)
sinh(x)
cosh(x)
tanh(x)
exp(x)
log(x)
log10(x)
pow(x,y)
sqrt(x)
ceil(x)
floor(x)
fabs(x)
ldexp(x)
frexp(x,double *ip)
modf(x,double *ip)
fmod(x,y)
Diagnostics: <assert.h>
void assert(int expression)
127
Non-local Jumps: <setjmp.h>
int setjmp(jmp_buf env)
void longjmp(jmp_buf env, int val)
Signals: <signal.h>
void (*signal(int sig, void (*handler)(int)))(int)
128