Vous êtes sur la page 1sur 38

A

Project Report On

MEDICINE
MANAGEMENT
SYSTEM
Submitted to MD University in partial fulfillment
of the requirements
For the award of the degree of
B.E.(IV semester) in Computer Application
In

MANAV RACHNA COLLEGE OF


ENGINEERING
SECTOR-43, FARIDABAAD

SUBMITTED BY:ANUKOOL SHAH SUBMITTEDTO: Mrs.


RAKHI PRUTHI

ROLL NO.:2K7-MRCE-CSE-100 SEMESTER:4TH

BRANCH:COMPUTER SCIENCE YEAR:2008-2009


Candidate’s Declaration

I ANUKOOL SHAH, hereby declare that the report of

the project entitled “MEDICINE MANAGEMENT

SYSTEM” has not been presented as a part of any

other academic work to get my degree or certificate

except MRCE for the fulfillment of the requirement

for the degree of B.Tech Computer Application. The

feasible suggestions have been duly incorporated in

consultation with the supervisor.

SIGNATURE OF THE SUPERVISOR

SIGNATURE OF THE CANDIDATE

FORWARDED BY:ANUKOOL SHAH


2K7-MRCE-CSE-100

ACKNOWLEDGEMENT

With immense pleasure, I would like to present this project


report for THE SUMMER TRAINING i underwent at study circle. It has
been an enriching experience for me to undergo my summer
training at THE INSTITUTE which would not have possible without the
goodwill and support of the people around. As a student of MRCE I
would like to express my sincere thanks to all those who helped me
during my practical training program.

Words are insufficient to express


my gratitude toward Mr. GIRISH KUMAR, Director of the
institute. I am very thankful to All other who helped me at every
step whenever needed.

At last but not least my grateful thanks is also extended to Ms.


NIDHI and my thanks to all my faculty members for the proper
guidance and assistance extended by them. I am also grateful to my
parents, friends, to encourage & giving me moral support.

However, I accept the sole responsibility for any possible error


of omission and would be extremely grateful to the readers of this
project report if they bring such mistakes to my notice.

Date :9-september-2009

Duration: 6 weeks

Semester: 4th
INDEX

 INTRODUCTION TO LANGUAGE
 EVOLUTION OF LANGUAGE
 CHARACTERISTICS OF LANGUAGE
 REQUIREMENT OF THE PROJECT
 INTRODUCTION TO PROJECT
 CODING OF THE PROJECT
 TESTING OF THE PROJECT
 BIBLIOGRAPHY
EVOLUTION OF LANGUAGE
We begin our journey of C++ with a little history. C, the predecessor to C++,
has become one of the most popular programming languages. Originally
designed for systems programming, C enables programmers to write efficient
code and provided close access to the machine. C compilers, found on
practically every Unix system, are now available with most operating systems.

During the 1980s and into the 1990s, an explosive growth in object-oriented
technology began with the introduction of the Smalltalk language. Object-
Oriented Programming (OOP) began to replace the more traditional structured
programming techniques. This explosion led to the development of languages
which support programming with objects. Many new object-oriented
programming languages appeared: Object-Pascal, Modula-2, Mesa, Cedar,
Neon, Objective-C, LISP with the Common List Object System (CLOS), and, of
course, C++. Although many of these languages appeared in the 1980s, many
ideas of OOP were taken from Simula-67. Yes! OOP has been around since
1967.

C++ originated with Bjarne Stroustrop. In the simplest sense, if not the most
accurate, we can consider it to be a better C. Although it is not an entirely new
language, C++ represents a significant extension of C abilities. We might then
consider C to be a subset of C++. C++ supports essentially every desirable
behavior and most of the undesirable ones of its predecessor, but provides
general language improvements as well as adding OOP capability. Note that
using C++ does not imply that your are doing OOP. C++ does not force you to
use its OOP features. You can simply create structured code that uses only C+
+'s non-OOP features.

INTRODUCTION TO C++

C++ is an "object oriented" programming language created


by Bjarne Stroustrup and released in 1985. It implements
"data abstraction" using a concept called "classes", along
with other features to allow object-oriented programming.
Parts of the C++ program are easily reusable and extensible;
existing code is easily modifiable without actually having to
change the code. C++ adds a concept called "operator
overloading" not seen in the earlier OOP languages and it
makes the creation of libraries much cleaner.

C++ maintains aspects of the C programming language, yet


has features which simplify memory management.
Additionally, some of the features of C++ allow low-level
access to memory but also contain high level features.

C++ could be considered a superset of C. C programs will run


in C++ compilers. C uses structured programming concepts
and techniques while C++ uses object oriented programming
and classes which focus on data.

C++ is a widely used language and remains one of the most


popular languages ever created.some of its applications
domains include system softwares,applications
software,device drivers,embedded softwares,high
performance server and client applications and entertainment
softwares such as video games.
CHARACTERISTICS OF C++
Operators and operator overloading

C++ provides more than 30 operators, covering basic arithmetic, bit


manipulation, indirection, comparisons, logical operations and others. Almost all
operators can be overloaded for user-defined types, with a few notable
exceptions such as member access (. and .*). The rich set of overloadable
operators is central to using C++ as a domain specific language. The
overloadable operators are also an essential part of many advanced C++
programming techniques, such as smart pointers. Overloading an operator does
not change the precedence of calculations involving the operator, nor does it
change the number of operands that the operator uses (any operand may
however be ignored).

Templates

C++ templates enable generic programming. C++ supports both function and
class templates. Templates may be parameterized by types, compile-time
constants, and other templates. C++ templates are implemented by
instantiation at compile-time. To instantiate a template, compilers substitute
specific arguments for a template's parameters to generate a concrete function
or class instance. Templates are a powerful tool that can be used for generic
programming, template metaprogramming, and code optimization, but this
power implies a cost. Template use may increase code size, since each template
instantiation produces a copy of the template code

Objects

C++ introduces object-oriented (OO) features to C. It offers classes, which


provide the four features commonly present in OO (and some non-OO)
languages: abstraction, encapsulation, inheritance, and polymorphism. Objects
are instances of classes created at runtime. The class can be thought of as a
template from which many different individual objects may be generated as a
program runs.
Encapsulation is the hiding of information in order to ensure that data structures
and operators are used as intended and to make the usage model more obvious
to the developer. C++ provides the ability to define classes and functions as its
primary encapsulation mechanisms. Within a class, members can be declared as
either public, protected, or private in order to explicitly enforce encapsulation. A
public member of the class is accessible to any function. A private member is
accessible only to functions that are members of that class and to functions and
classes explicitly granted access permission by the class ("friends"). A protected
member is accessible to members of classes that inherit from the class in
addition to the class itself and any friends

Inheritance
Inheritance allows one data type to acquire properties of other data types.
Inheritance from a base class may be declared as public, protected, or private.
This access specifier determines whether unrelated and derived classes can
access the inherited public and protected members of the base class. Only
public inheritance corresponds to what is usually meant by "inheritance". The
other two forms are much less frequently used. If the access specifier is
omitted, a "class" inherits privately, while a "struct" inherits publicly. Base
classes may be declared as virtual; this is called virtual inheritance. Virtual
inheritance ensures that only one instance of a base class exists in the
inheritance graph, avoiding some of the ambiguity problems of multiple
inheritance.

Polymorphism
Polymorphism enables one common interface for many implementations, and for
objects to act differently under different circumstances.

C++ supports several kinds of static (compile-time) and dynamic (run-time)


polymorphisms. Compile-time polymorphism does not allow for certain run-time
decisions, while run-time polymorphism typically incurs a performance penalty.

Static polymorphism

Function overloading allows programs to declare multiple functions having the same
name (but with different arguments). The functions are distinguished by the number
and/or types of their formal parameters. Thus, the same function name can refer to
different functions depending on the context in which it is used. The type returned by
the function is not used to distinguish overloaded functions.

Dynamic polymorphism

Inheritance

Variable pointers (and references) to a base class type in C++ can refer to objects of
any derived classes of that type in addition to objects exactly matching the variable
type. This allows arrays and other kinds of containers to hold pointers to objects of
differing types. Because assignment of values to variables usually occurs at run-time,
this is necessarily a run-time phenomenon.

C++ also provides a dynamic_cast operator, which allows the program to safely
attempt conversion of an object into an object of a more specific object type (as
opposed to conversion to a more general type, which is always allowed). This feature
relies on run-time type information (RTTI). Objects known to be of a certain specific
type can also be cast to that type with static_cast, a purely compile-time construct
which is faster and does not require RTTI.

Virtual member functions

Ordinarily when a function in a derived class overrides a function in a base class, the
function to call is determined by the type of the object. A given function is overridden
when there exists no difference, in the number or type of parameters, between two or
more definitions of that function. Hence, at compile time it may not be possible to
determine the type of the object and therefore the correct function to call, given only a
base class pointer; the decision is therefore put off until runtime. This is called
dynamic dispatch. Virtual member functions or methods allow the most specific
implementation of the function to be called, according to the actual run-time type of
the object. In C++, this is commonly done using virtual function tables. If the object
type is known, this may be bypassed by prepending a fully qualified class name
before the function call, but in general calls to virtual functions are resolved at run
time.

REQUIREMENTS OF THE PROJECT

The project needs a deep understanding of basic


concepts of C++ like classes, objects and various file
handling techniques. The database is made with the
help of files with .DAT extension.
This project uses extensive functions from graphics
library for highlightening of text and background that
are included in header files like <graphics.h>.Thus
knowledge of including and detecting graphics
driver, graphics mode is an important concept for the
beginning.
Various header files for the standardized and
formatted outputs have been used for an effective and
user friendly environment.
The project requires to be run on turbo c. In order to
view the existing records a file named medicine.dat
has to be copied to the destined location for viewing
the records entered previously.

INTRODUCTION TO THE PROJECT

 MEDICINE MANAGEMENT SYSTEM is an


application that a hospital and medical stores
maintains in order to give a modern effective
management for maintenance of all the records
according to the medicine codes, names etc.
 MEDICINE MANAGEMENT system receives

and maintains data regarding medicine like


rates, quantity and also availability of the
particular medicine in the stock kit handles
editing and updating of data about any
medicine and company of medicine
 Medicine Management System Starts With an
Introduction Screen In Which It Shows Name
Of Project, Name Of the Person Submitted By
& Name Of the Person Guided By.
 After that Press Enter Main Screen opens in
which it asks for 5 choices and from that we
can choose only one at a time.
 After selecting each option available, the
project allows any medicinal department to
perform all the needful functions to maintain
such department

CODING FOR THE SYSTEM

/****************************************************************************
MEDICINE MANAGEMENT
****************************************************************************/

// Header files inclusion

#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<dos.h>
#include<graphics.h>
#include<process.h>

// Creation of the class for record maintenance


class med
{
private:
int sno;
float price;
char name[40];
char mdate[20];
char edate[20];
char licno[30];
double cost;
char mfgno[30];
char medtype[30];
char comname[40];
double qty;
public:
int snno();
void menu();
void newentry();
void listing();
void search();
void medname();
void sa();
void edit();
void sale();
void purchase();
void fail();
void sales();
void del();
void update();
void quit();
};

// Object creation for the class

med m;
fstream f1;

// Function creation for Serial No.

int med::snno()
{
fstream file;
file.open("medicine.dat",ios::in|ios::binary);
file.seekg(0,ios::beg);
int count = 0;
while(file.read((char*) this, sizeof(med)))
count=sno;
file.close();
return count;
}
// Function created for main menu
void med::menu()
{
int ch;
A:
clrscr();
int driver, mode;
detectgraph(&driver, &mode);
initgraph(&driver, &mode, "..\\bgi");
int font=7;
int direction=0;
int charsize=4;
moveto(205,60);
setcolor(10);
settextstyle(font, direction,charsize);
outtext("MAIN-MENU");

gotoxy(29,10);
cout<<"1. Medicine Addition";
gotoxy(29,12);
cout<<"2. List of Medicines";
gotoxy(29,14);
cout<<"3. Sales Wizard";
gotoxy(29,16);
cout<<"4. Edit Wizard";
gotoxy(29,18);
cout<<"5. Exit";

gotoxy(24,23);
delay(1050);
char s2[] = "Enter your choice(1-5) - ";
for(int i=0; i<26; ++i)
{
delay(30);
cout<<s2[i];
}
cin>>ch;

closegraph();

switch(ch)
{
case 1 : m.newentry();
break;
case 2 : m.listing();
break;
case 3 : m.sales();
break;
case 4 : m.edit();
break;
case 5 : m.quit();
break;
default : clrscr();
gotoxy(33,12);
textcolor(10);
cprintf("Invalid Choice...");
getch();
goto A;
}
}
// Function created for record entry of the Medicine
void med:: newentry()
{
int a=m.snno();
f1.open("medicine.dat", ios::app|ios::binary);
if(!f1)
cout<<"Cannot open the file";
else
{
A:
clrscr();
int driver, mode;
detectgraph(&driver, &mode);
initgraph(&driver, &mode, "..\\bgi ");
int font=7;
int direction=0;
int size=3;
int i;
moveto(150,20);
setcolor(15);
settextstyle(font, direction, size);
outtext(" RECORD ENTRY");
// closegraph();

gotoxy(19,8);
char a1[] = "Enter Medicine Name : ";
for(i=0; i<30; ++i)
{
delay(25);
cout<<a1[i];
}
gets(name);

if(strlen(name) == 0)
{
gotoxy(19,10);
cout<<"Enter the name correctly";
getch();
goto A;
}

gotoxy(19,9);
char a2[] = "Enter Medicine type : ";
for(i=0; i<30; ++i)
{
delay(25);
cout<<a2[i];
}
gets(medtype);

gotoxy(19,10);
char a3[] = "Enter Company Name : ";
for(i=0; i<30; ++i)
{
delay(25);
cout<<a3[i];
}
gets(comname);

gotoxy(19,11);
char a4[] = "Enter Mnf'g Date(mmm-yy) : ";
for(i=0; i<30; ++i)
{
delay(25);
cout<<a4[i];
}
gets(mdate);

gotoxy(19,12);
char a5[] = "Enter Expiry Date(mmm-yy) : ";
for(i=0; i<30; ++i)
{
delay(25);
cout<<a5[i];
}
gets(edate);

gotoxy(19,13);
char a6[] = "Enter Batch No. : ";
for(i=0; i<30; ++i)
{
delay(25);
cout<<a6[i];
}
gets(mfgno);

gotoxy(19,14);
char a7[] = "Enter Licence No. : ";
for(i=0; i<30; ++i)
{
delay(25);
cout<<a7[i];
}
gets(licno);

gotoxy(19,15);
char a8[] = "Enter Cost of Medicine : Rs. ";
for(i=0; i<34; ++i)
{
delay(25);
cout<<a8[i];
}
cin>>cost;

gotoxy(19,16);
char a9[] = "Enter Quantity of Medicine : ";
for(i=0; i<30; ++i)
{
delay(25);
cout<<a9[i];
}
cin>>qty;
sno = a+1;
f1.write((char*)&m,sizeof(m));
}

f1.close();

gotoxy(48,24);
cout<<"press any key to return.......";
getch();
m.menu();
}

// Function Created for List View of Medicine

void med::listing()
{
f1.open("medicine.dat",ios::in|ios::binary);

if(!f1)
{
clrscr();
gotoxy(30,15);
cout<<"File not found";
getch();

}
else
{
f1.read((char*)&m,sizeof(m));
int driver, mode;
detectgraph(&driver, &mode);
initgraph(&driver, &mode, "..\\bgi ");
int font=7;
int direction=0;
int size=3;
setcolor(15);
moveto(165,10);
settextstyle(font, direction, size);
outtext(" RECORD LISTING");

gotoxy(5,5);
cout<<"S.No. "<<" Med. Name "<<" Med. Type "<<" Cost "<<"
Quantity ";

delay(1050);
gotoxy(4,4);
char ch[] =
"úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú
úúúúú";
for(int i=0; i<74; ++i)
{
delay(5);
cout<<ch[i];
}
gotoxy(4,6);
char ch2[] =
"úúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúúú
úúúúú";
for(i=0; i<74; ++i)
{
delay(5);
cout<<ch2[i];
}

int s = 7;

while(!f1.eof())
{
textcolor(10);
gotoxy(6,s);
cout<<sno<<endl;
gotoxy(14,s);
cout<<name<<endl;
gotoxy(38,s);
cout<<medtype<<endl;
gotoxy(55,s);
cout<<"Rs."<<cost<<endl;
gotoxy(69,s);
cout<<qty<<endl;
s = s+1;
f1.read((char*)&m,sizeof(m));
}
}
f1.close();
getch();
m.menu();
}

// Function created for exiting the management

void med::quit()
{
clrscr();
exit(0);
}
// Function created for Selling & Purchasing of Medicines

void med::sales()
{
int ch;
clrscr();
int driver, mode;
detectgraph(&driver, &mode);
initgraph(&driver, &mode, "..\\bgi");
int font=7;
int direction=0;
int charsize=4;
moveto(155,60);
setcolor(10);
settextstyle(font, direction,charsize);
outtext(" SALES WIZARD");
gotoxy(30,9);
cout<<"1. Medicine Sale";
gotoxy(30,11);
cout<<"2. Medicine Purchase";
gotoxy(30,13);
cout<<"3. Record Listing";
gotoxy(30,15);
cout<<"4. Main Menu";

gotoxy(28,19);
delay(1000);
char c1[] = "Enter your choice(1-4) - ";
for(int i=0; i<26; ++i)
{
delay(25);
cout<<c1[i];
}
cin>>ch;
closegraph();

switch(ch)
{
case 1 : m.sale();
break;
case 2 : m.purchase();
break;
case 3 : m.listing();
break;
case 4 : m.menu();
break;
default : clrscr();
gotoxy(33,12);
cout<<"Invalid Choice...";
getch();
m.sales();
break;
}
}

// Function created for Selling of Medicines

void med::sale()
{
WW:
clrscr();
char nam[30];
double qu;
long double price;
int g;
int c=0;
int q;
clrscr();
fstream f1("medicine.dat", ios::in|ios::out|ios::binary);
f1.read((char*)&m,sizeof(m));
f1.seekg(0);
g = f1.tellg();
textcolor(14);
gotoxy(6,3);
cprintf("Medicine Name : ");
gets(nam);
gotoxy(21,5);
textcolor(10);
if(!f1)
{
clrscr();
gotoxy(26,15);
cout<<"File not found";
getch();
}
else
{
while(!f1.eof())
{
f1.read((char*)&m,sizeof(m));
if(strcmp(name, nam) == 0)
{
c=1;
textcolor(12);
g = f1.tellg();
gotoxy(15,8);
cprintf("1. Medicine Name : ");
cout<<name<<endl;
gotoxy(15,9);
cprintf("2. Medicine Type : ");
cout<<medtype<<endl;
gotoxy(15,10);
cprintf("3. Company Name : ");
cout<<comname<<endl;
gotoxy(15,11);
cprintf("4. Manufacturing Date : ");
cout<<mdate<<endl;
gotoxy(15,12);
cprintf("5. Expiry Date : ");
cout<<edate<<endl;
gotoxy(15,13);
cprintf("6. Batch No. : ");
cout<<mfgno<<endl;
gotoxy(15,14);
cprintf("7. Licence No. : ");
cout<<licno<<endl;
gotoxy(15,15);
cprintf("8. Medicine Cost : Rs. ");
cout<<cost<<endl;
gotoxy(15,16);
cprintf("9. Medicine Quantity : ");
cout<<qty<<endl;
break;
}

}
}
if(c==0)
{
clrscr();
gotoxy(28,12);
textcolor(5);
cprintf("NAME NOT FOUND");
textcolor(12);
gotoxy(48,24);
cprintf("Press a key to continue....");
getch();
f1.close();
m.sales();
}

gotoxy(48,18);
textcolor(7);
cprintf("Press a key to continue.......");
getch();

gotoxy(15,22);
textcolor(10);
cprintf("Enter Quantity for Sale : ");
cin>>q;
if(q > qty)
{
clrscr();
gotoxy(30,16);
textcolor(6);
cprintf("Invalid Entry");
getch();
goto WW;
}

fflush(stdin);
qu=q;
price=qu*cost;
gotoxy(15,24);
cprintf("Total Cost : Rs.");
cout<<price<<endl;
gotoxy(15,23);
textcolor(13);
cprintf("Medicine Quantity Remaining: ");
qty = qty - q;
cout<<qty;
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
getch();
m.menu();
}

// Function created for Medicine required for selling


// and puchasing
void med::medname()
{
gotoxy(25,8);
textcolor(10);
cprintf("Medicine Name : ");
cout<<name<<endl;
gotoxy(25,9);
cprintf("Medicine Type : ");
cout<<medtype<<endl;
gotoxy(25,10);
cprintf("Company Name : ");
cout<<comname<<endl;
gotoxy(25,11);
cprintf("Manufacturing Date : ");
cout<<mdate<<endl;
gotoxy(25,12);
cprintf("Expiry Date : ");
cout<<edate<<endl;
gotoxy(25,13);
cprintf("Batch No. : ");
cout<<mfgno<<endl;
gotoxy(25,14);
cprintf("Licence No. : ");
cout<<licno<<endl;
gotoxy(25,15);
cprintf("Medicine Cost : Rs. ");
cout<<cost<<endl;
gotoxy(25,16);
cprintf("Medicine Quantity : ");
cout<<qty<<endl;
}

// Function created for Purchase of Medicines

void med::purchase()
{
int g;
int q;
int c=0;
clrscr();
fstream f1("medicine.dat", ios::in|ios::out|ios::binary);
f1.read((char*)&m,sizeof(m));
f1.seekg(0);
g = f1.tellg();
char s[25];
textcolor(14);
gotoxy(6,3);
cprintf("Name of Medicine : ");
gets(s);
gotoxy(21,5);
textcolor(10);
if(!f1)
{
clrscr();
gotoxy(26,15);
cout<<"File not found";
getch();
}
else
{
while(!f1.eof())
{
f1.read((char*)&m,sizeof(m));
if(strcmp(name,s) == 0)
{
c=1;
textcolor(12);
g = f1.tellg();
gotoxy(15,8);
cprintf("1. Medicine Name : ");
cout<<name<<endl;
gotoxy(15,9);
cprintf("2. Medicine Type : ");
cout<<medtype<<endl;
gotoxy(15,10);
cprintf("3. Company Name : ");
cout<<comname<<endl;
gotoxy(15,11);
cprintf("4. Manufacturing Date : ");
cout<<mdate<<endl;
gotoxy(15,12);
cprintf("5. Expiry Date : ");
cout<<edate<<endl;
gotoxy(15,13);
cprintf("6. Batch No. : ");
cout<<mfgno<<endl;
gotoxy(15,14);
cprintf("7. Licence No. : ");
cout<<licno<<endl;
gotoxy(15,15);
cprintf("8. Medicine Cost : Rs. ");
cout<<cost<<endl;
gotoxy(15,16);
cprintf("9. Medicine Quantity : ");
cout<<qty<<endl;
break;
}
}
}
if(c==0)
{
clrscr();
gotoxy(28,12);
textcolor(5);
cprintf("NAME NOT FOUND");
textcolor(12);
gotoxy(48,24);
cprintf("PRESS ANY KEY TO CONTINUE...");
getch();
f1.close();
m.sales();
}
gotoxy(48,18);
textcolor(7);
cprintf("Press a key to continue.......");
getch();

gotoxy(15,22);
textcolor(10);
cprintf("Enter Quantity to Add : ");
cin>>q;
fflush(stdin);
gotoxy(15,23);
textcolor(13);
cprintf("Medicine Quantity : ");
qty = qty + q;
cout<<qty;
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
getch();
m.menu();
}

// Function created for Updation & Deletion of Records

void med::edit()
{
clrscr();
S:
int driver, mode;
int ch;
detectgraph(&driver, &mode);
initgraph(&driver, &mode, "..\\bgi");
int font=7;
int direction=0;
int size=3;
moveto(155,60);
setcolor(6);
settextstyle(font, direction, size);
outtext("RECORD EDITION MENU");

gotoxy(32,9);
cout<<"1. Search Records";
gotoxy(32,11);
cout<<"2. Update Records";
gotoxy(32,13);
cout<<"3. Delete Records";
gotoxy(32,15);
cout<<"4. Record Listing";
gotoxy(32,17);
cout<<"5. Main Menu";

gotoxy(28,20);
delay(1000);
char c2[] = "Enter your choice (1-5) - ";
for(int i=0; i<26; ++i)
{
delay(25);
cout<<c2[i];
}
cin>>ch;
closegraph();

switch(ch)
{
case 1 : m.search();
break;
case 2 : m.update();
break;
case 3 : m.del();
break;
case 4 : m.listing();
break;
case 5 : m.menu();
break;
default: clrscr();
gotoxy(33,12);
textcolor(14+128);
cprintf("Invalid Choice");
getch();
m.edit();
goto S;
}
}

// Function created for Searching the Record of Medicine

void med::search()
{
int i,z;
char a[10];
clrscr();
ifstream f1;
f1.open("medicine.dat");
gotoxy(15,3);
textcolor(13);
cprintf("Enter the Name : ");
cin>>a;
gotoxy(15,5);
textcolor(11+128);
cprintf("Searching......");
while(!f1.eof())
{
f1.read((char*)&m,sizeof(m));
if(strcmp(a,name) == 0)
{
gotoxy(15,5);
delay(1050);
// textcolor(14+128);
cprintf(" ");
gotoxy(20,5);
textcolor(12);
cprintf("Found - 1");
gotoxy(25,8);
textcolor(10);
cprintf("Medicine Name : ");
cout<<name<<endl;
gotoxy(25,9);
cprintf("Medicine Type : ");
cout<<medtype<<endl;
gotoxy(25,10);
cprintf("Company Name : ");
cout<<comname<<endl;
gotoxy(25,11);
cprintf("Manufacturing Date : ");
cout<<mdate<<endl;
gotoxy(25,12);
cprintf("Expiry Date : ");
cout<<edate<<endl;
gotoxy(25,13);
cprintf("Batch No. : ");
cout<<mfgno<<endl;
gotoxy(25,14);
cprintf("Licence No. : ");
cout<<licno<<endl;
gotoxy(25,15);
cprintf("Medicine Cost : Rs. ");
cout<<cost<<endl;
gotoxy(25,16);
cprintf("Medicine Quantity : ");
cout<<qty<<endl;
gotoxy(25,19);
cprintf("Serial No. : ");
cout<<sno;

gotoxy(48,24);
textcolor(14);
cprintf("Press a key to return......");
getch();
}
}
f1.close();
m.edit();
getch();
}

// Function created for Updation of records

void med::update()
{
int g;
int n;
clrscr();
fstream f1("medicine.dat", ios::in|ios::out|ios::binary);
f1.read((char*)&m,sizeof(m));
f1.seekg(0);
g = f1.tellg();
int s;
char na[15];
textcolor(14);
gotoxy(6,3);
cprintf("Serial No. of Medicine to update : ");
cin>>s;
gotoxy(21,5);
textcolor(10);
if(!f1)
{
clrscr();
gotoxy(26,15);
cout<<"File not found";
getch();
}
else
{
while(!f1.eof())
{
f1.read((char*)&m,sizeof(m));
if(sno == s)
{
textcolor(12);
g = f1.tellg();
gotoxy(15,8);
cprintf("1. Medicine Name : ");
cout<<name<<endl;
gotoxy(15,9);
cprintf("2. Medicine Type : ");
cout<<medtype<<endl;
gotoxy(15,10);
cprintf("3. Company Name : ");
cout<<comname<<endl;
gotoxy(15,11);
cprintf("4. Manufacturing Date : ");
cout<<mdate<<endl;
gotoxy(15,12);
cprintf("5. Expiry Date : ");
cout<<edate<<endl;
gotoxy(15,13);
cprintf("6. Batch No. : ");
cout<<mfgno<<endl;
gotoxy(15,14);
cprintf("7. Licence No. : ");
cout<<licno<<endl;
gotoxy(15,15);
cprintf("8. Medicine Cost : Rs. ");
cout<<cost<<endl;
gotoxy(15,16);
cprintf("9. Medicine Quantity : ");
cout<<qty<<endl;
break;
}
}
}
gotoxy(48,18);
textcolor(7);
cprintf("Press a key to continue.......");
getch();

gotoxy(6,19);
textcolor(10);
cprintf("Enter Field No. Wish to Modify : ");
cin>>n;
fflush(stdin);

textcolor(11);
switch(n)
{
case 1 : gotoxy(15,21);
cprintf("Medicine Name : ");
gets(name);
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

case 2 : gotoxy(15,21);
cprintf("Medicine Type : ");
gets(medtype);
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

case 3 : gotoxy(15,21);
cprintf("Company Name : ");
gets(comname);
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

case 4 : gotoxy(15,21);
cprintf("Manufacturing Date : ");
gets(mdate);
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

case 5 : gotoxy(15,21);
cprintf("Expiry Date : ");
gets(edate);
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

case 6 : gotoxy(15,21);
cprintf("Batch No. : ");
gets(mfgno);
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

case 7 : gotoxy(15,21);
cprintf("Licence No. : ");
gets(licno);
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

case 8 : gotoxy(15,21);
cprintf("Medicine Cost : Rs. ");
cin>>cost;
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

case 9 : gotoxy(15,21);
cprintf("Medicine Quantity : ");
cin>>qty;
f1.seekp(g-sizeof(m));
f1.write((char*)&m,sizeof(m));
f1.close();
f1.read((char*)&m,sizeof(m));
break;

default : clrscr();
gotoxy(15,21);
textcolor(12);
cprintf("...Invalid Choice...");
getch();
m.edit();
break;
}

gotoxy(10,24);
textcolor(10+128);
cprintf("Updating......");

gotoxy(48,24);
textcolor(12);
delay(1170);
cprintf("Updation Complete.......");
gotoxy(10,24);
cprintf(" ");
getch();

m.edit();

}
// Function created for Deletion of Medicine Record
void med::del()
{
clrscr();
int sn;
char ch1;
fstream f1;
f1.open("medicine.dat", ios::in);
fstream f2;
f2.open("temp.dat", ios::out);
f1.seekg(0, ios::beg);
if(!f1)
{
gotoxy(27,12);
textcolor(10);
cout<<"File not found";
}
else
{
gotoxy(17,5);
textcolor(13);
cprintf("Enter the Serial No. Medicine : ");
cin>>sn;

while(f1)
{
if(f1.eof())
goto AA;
f1.read((char*)&m,sizeof(m));
if(sno != sn)
{
if(f1.eof())
goto AA;
f2.write((char*)&m,sizeof(m));
}
else
{
m.medname();
continue;
}
}
AA:
gotoxy(48,24);
textcolor(13);
cout<<"Press a key to return......";
getch();
f2.close();
f1.close();
remove("medicine.dat");
rename("temp.dat", "medicine.dat");
}
m.menu();
}
// The Main working Function of the program

void main()
{
int graphdriver,graphmode;
detectgraph(&graphdriver,&graphmode);
initgraph(&graphdriver,&graphmode,"..\\bgi ");
int font=8;
int direction=0;
int charsize=4;
setbkcolor(9);
moveto(215,35);
setcolor(10);
settextstyle(1,0,4);
outtext("PROJECT ON");
moveto(140,140);
outtext("FOR FULFILLMENT OF");
moveto(160,190);
outtext("DEGREE IN B.E. IN");
moveto(60,250);
settextstyle(1,0,3);
outtext("MANAV RACHNA COLLEGE OF ENGINEERING");
moveto(60,370);
settextstyle(3,0,2);
setcolor(3);
outtext("Guided By:");
moveto(60,400);
setcolor(12);
outtext("Mr. GIRISH KUMAR");
moveto(50,70);
setcolor(14);
settextstyle(5,direction,5);
outtext("MEDICINE MANAGEMENT");
font=3;
charsize=1;
setcolor(3);
settextstyle(font,direction,charsize);
charsize = 2;
moveto(420,370);
outtext("Submitted By:");
moveto(420,400);
setcolor(12);
outtext("ANUKOOL SHAH");
getch();
closegraph();

clrscr();
m.menu();
getch();
}
TESTING OF THE PROJECT
1.INTRODUCTION SCREEN

2. MAIN SCREEN
3.ADDING THE MEDICINE DETAILS

4.RECORD LISTING
5.SALES WIZARD-MENU
6.SALES WIZARD-MEDICINE SALES

7.SALES WIZARD-MEDICINE
PURCHASE

8.EDIT WIZARD-MENU
9.EDIT WIZARD-SEARCH RECORDS

10.EDIT WIZARD-UPDATE RECORD


11.EDIT WIZARD-DELETE RECORD
BIBLIOGRAPHY

1. DEFINITIONS FROM
WHATIS.COM

2. A TEXTBOOK ON C++ BY E.
BALAUGURUAWMY

3. EFFECTIVE C++ by Scott Meyers

Vous aimerez peut-être aussi