Вы находитесь на странице: 1из 43

COMPUTER SCIENCE PROJECT

SESSION 2019-20
PHARMACEUTICAL COMPANY

SUBMITTED BY SUBMITTED TO
RICHA KOTHARI MR.VINOD MISHRA
XII-A
INDEX
S.No. Contents Page no

1 Certificate 1
2 Acknowledgement 2
3 Introduction 3
4 Project Summary 4
5 Screen shots 6
6 Source Code 18
CERTIFICATE

This is to certify that I, Arushi Srivastava


of standard XII-A has prepared the
project on Data File Handling of topic

‘Pharmaceutical
Company’
with all included concepts of C++ with
the help of our Computer Science teacher,
Mr. Vinod Mishra for session 2019-20.

External Examiner Subject teacher Principal


ACKNOWLEDGEMENT

I wish to express my deep gratitude and sincere


thanks to Principal, ……(;principal Name)…………., Seth
M.R. Jaipuria School, Lucknow for her
encouragement and for all the facilities that she
provided for this project work. I sincerely
appreciate this magnanimity by taking me into her
fold for which I shall remain indebted to her. I
extend my hearty thanks to Mr. Vinod Mishra,
Computer teacher, who guided me to the successful
completion of this project. I take this opportunity
to express my deep sense of gratitude for his
invaluable guidance, constant encouragement,
constructive comments, sympathetic attitude and
immense motivation, which has sustained my efforts
at all stages of this project work. I can’t forget to
offer my sincere thanks to my classmates who
helped me to carry out this project work
successfully and for their valuable advice and
support, which I received from them time to time..

Name: Arushi Srivastava

Class: XII-A
INTRODUCTION

The Project is based on “Pharmaceutical


Information” and deals with various
functions of different techniques. In this
project customer and admin both can
work according to their convenience of
multiple options provided.
This program also contains two chambers,
one for admin and second for customer.
PROJECT SUMMARY

SECONDAY THEIR USE IN FUNCTION


STORAGE

Drug.dat THIS DATA MEMBER STORES:


 DRUG NAME.
 DRUG SCIENTIFIC NAME
 DRUG MANUFACTURING
PRICE
 DRUG SELLING PRICE
PROJECT SUMMARY

Function purpose
name
1) VOID COMP() IT’S USED FOR WELCOME
MESSAGE OF COMNPANY.

2) VOID AREAINF() IT’S USED FOR ZONES OF


COMPANY

3) VOID ENTRY() IT’S USED FOR ENTRY


NOF RECORD

4) VOID ADD() IT’S PURPOSE ID TO ADD


THE RECORD TO FILE.
5) VOID DISPLAY() THIS DISPLAY IS FOR
ADMIN TO VIEW ADDED
RECORD.

6) VOID DISP() TO DISPLAY RECORD TO


CUSTOMER

7) VOID SEARCH() TO SEARCH ABOUT THE


DRUG

8) VOID DEL() TO DELETE THE DRUG


RECORD

9) VOID MODIFY() TO MODIFY DETAILS OF


DRUG RECORD ENTERED
EARLIER

10) VOID ORDER() TO MAKE ORDER OF ANY


DRUG AND DISPLAY BILL

11) VOID TO DISPLAY COMPANY’S


CONTACT() CONTACT DETAILS
12) VOID MENU() THIS FUNCTION IS FOR
OPTON SELECTION OF
ADMIN OR CUSTOMER

13) VOID ADMIN() TO PROVIDE OPTIONS OF


SEARCH, MODIFY, DELETE,
DISPLAY & ADD FOR
ADMIN

14) VOID TO PROVIDE OPTIONS OF


CUSTOMER() ORDER, SEARCH, DISPLAY
& CONTACT FOR
CUSTOMER

15) VOID MAIN() TO INTIALIZE THE


EXECUTION OF COMP(),
AREAINF(), ENTRY() &
MENU().
SCREEN
SHOTS
WELCOME PAGE

MAIN MENU
ADMIN MENU

ADD
SEARCH

DELETE
MODIFY

DISPLAY
CUSTOMER MENU

ORDER
SEARCH

DISPLAY
CONTACT
SOURCE
CODE

#include<iostream.h>
#include<iomanip.h>
#include<fstream.h>
#include<iostream.h>
#include<iomanip.h>
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
class pharm
{
public:
char nmdg[40], real[40];
int no,mp, sp;
public:
pharm (int no1,int mp1,int sp1)
{
no = no1;
mp = mp1;
sp = sp1;
}
void comp ()
{

cout << endl << endl;


cout <<"
******************************************************************
*"<< endl;
cout <<" |***** *****|"<< endl;
cout <<" |**** ****|"<< endl;
cout <<" |*** ***|"<< endl;
cout <<" |** **|"<< endl;
cout <<" |** **|"<< endl;
cout <<" |*** ***|"<< endl;
cout <<" |**** ****|"<< endl;
cout <<" |***** *****|"<< endl;
cout <<" ******* Welcome to the information screen *******"<< endl;
cout <<" *** ______MicroOrga Industries______ ***"<< endl;
cout <<" * +++++++++ *"<< endl;
cout <<" *** BTM Layout stage 2 ***"<< endl;
cout <<" ******* 560076 *******"<< endl;
cout <<" |***** *****|"<< endl;
cout <<" |**** ****|"<< endl;
cout <<" |*** ***|"<< endl;
cout <<" |** **|"<< endl;
cout <<" |** **|"<< endl;
cout <<" |*** ***|"<< endl;
cout <<" |**** PRESS ENTER ****|"<< endl;
cout <<"
******************************************************************
*"<< endl;
cin.get();
}

void areainf ()
{

cout << endl << endl;


cout <<" |*****-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-
*****|"<< endl;
cout <<" |**** ****|"<< endl;
cout <<" |*** ***|"<< endl;
cout <<" |** **|"<< endl;
cout <<" |** **|"<< endl;
cout <<" |*** ***|"<< endl;
cout <<" |**** ****|"<< endl;
cout <<" |***** *****|"<< endl;
cout <<" | ZONES |"<< endl;
cout <<" | ZONE EAST: GUWAHATI |"<< endl;
cout <<" | ZONE WEST: MUMBAI |"<< endl;
cout <<" | ZONE NORTH: DELHI |"<< endl;
cout <<" | ZONE SOUTH: BANGALURU |"<< endl;
cout <<" |***** *****|"<< endl;
cout <<" |**** ****|"<< endl;
cout <<" |*** ***|"<< endl;
cout <<" |** **|"<< endl;
cout <<" |** **|"<< endl;
cout <<" |*** ***|"<< endl;
cout <<" |**** PRESS ENTER ****|"<< endl;
cout <<" |*****-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-
*****|"<< endl;
cin.get();

}
void entry ()
{

// gotoxy(15,6);
cout << "\t \t \t TERRASOL PHARMA";
// gotoxy(10,8);
cout << "drug record";
// gotoxy(17,10);
cout << "examples of drugs available:";
cout << "\n\tdisprin \n" << "\tparacetamol\n" << "\tsumo cold\n" <<
"\tallegra120\n" << "\tD cold\n";
}
void add()

{
pharm c(0,0,0);
fstream f1("drug.dat",ios::out);
char a='y';

while(a=='y')
{
cout <<
"\t ** || ** ** || ** ** || ** **
|| ** ** || ** ** || **"
<< endl;
cout<<"\n\tEnter drug number :";
cin>>c.no;
cout<<"\n\t Enter drug name :";
gets(c.nmdg);
cout<<"\n\t Enter the scientific name :";
gets(c.real);
cout<<"\n\t Enter the manufacturing price :";
cin>>c.mp;
cout<<"\n\t Enter the selling price :";
cin>>c.sp;
f1.write((char*)&c,sizeof(c));
cout <<"\t ** || ** ** || ** ** || ** ** || ** ** || ** ** || **"<< endl;
cout << "\n\t WANT TO ENTER
MORE ??(Y/N)";
cin>>a;
}
f1.close();
}
void display()
{
pharm c(0,0,0);
clrscr();

fstream f1("drug.dat",ios::in);
f1.seekg(0);
cout<<"\n";
while( f1.read((char*)&c,sizeof(c)))
{

cout <<"\t ** || ** ** || ** ** || ** ** || ** ** || ** ** || **"


<< endl;
cout<<"\n\n\t\tdrug number: "<<c.no<<"\n\n\t\tdrug name:
"<<c.nmdg<<"\n\n\t\t real name: "<<c.real<<"\n\n\t\t manufacturing price
:"<<c.mp<<"\n\n\t\tselling price :"<<c.sp;
cout <<"\t ** || ** ** || ** ** || ** ** || ** ** || ** ** || **"
<< endl;
}
f1.close();
}

void disp ()
{
clrscr();
pharm c(0,0,0);
fstream f1 ("drug.dat", ios::in);
f1.seekg (0);
cout << "\n";
while (f1.read ((char *) &c, sizeof (c)))
{

cout <<"\t ** || ** ** || ** ** ||
** ** || ** ** || ** ** || **"
<< endl;
cout << "\n\tDrug Number: " << c.no
<< "\n\tDrug Name: " << c.nmdg << "\n\tPrice: Rs." << c.sp;
cout << endl;
cout <<"\t ** || ** ** || ** ** ||
** ** || ** ** || ** ** || **"
<< endl;
}

f1.close ();
}

//____________TO SEARCH FOR ANY DRUG DETAILS___________//


void search ()
{

clrscr();
pharm c(0,0,0);
int n;
int flag;
fstream f2 ("drug.dat", ios::in);
f2.seekg (0);
cout << "\n Enter drug number to search: ";
cin >> n;
while (f2.read ((char *) &c, sizeof (c)))
{
if (c.no == n)
{
flag = 1;
cout <<"\t ** || ** ** || ** **
|| ** ** || ** ** || ** ** || **"
<< endl;
cout << "\n DETAILS: ";
cout << "\n\tDrug number: " <<
c.no;
cout << "\n\tDrugname: " <<
c.nmdg;
cout << "\n\treal name: " << c.real;
cout << "\n\tManufaturign price: Rs.
" << c.mp;
cout << "\n\tSellinng price: Rs. " <<
c.sp;
cout <<"\t ** || ** ** || ** **
|| ** ** || ** ** || ** ** || **"
<< endl;
}
if(flag==1)
{
cout << "\n\n RECORD FOUND !!! ";
break;
}
}
if (flag == 0)
{
cout << "\n\n SORRY RECORD NOT
FOUND !!! ";
}

f2.close ();
}

//___________TO DELETE RECORD OF UNWANTED DRUG___________//

void del()
{
pharm c(0,0,0);
int flag,n;
fstream f1("drug.dat",ios::in);
fstream f2("drg.dat",ios::out);
f1.seekg(0);
cout<<"\n enter drug no to search:";
cin>>n;

while(f1)
{
f1.read((char*)&c,sizeof(c));
if(!f1.eof())
{
if(c.no==n)
{
flag=1;
}
else
{

f2.write((char*)&c,sizeof(c));
}
}
}
f1.close();
f2.close();
remove("drug.dat");
rename("drg.dat","drug.dat");
if(flag==0)
cout<<"\n\n sorry record not
found";
else
cout<<"\n record deleted";
}

//_______________TO MODIFY EXISTING DRUG DETAIL____________//


void modify ()
{
clrscr();
pharm c(0,0,0);
int n;
fstream f1 ("drug.dat",ios::in);
fstream f2 ("out.dat", ios::out);
f1.seekg (0);
cout << "\n Enter drug number to MODIFY:";
cin >> n;
int flag1;
f1.read ((char *) &c, sizeof (c));
while (!f1.eof ())
{

if (c.no == n)
{
flag1 = 1;

int z;
cout << "\n \tEnter NEW DRUG
NAME ";
cin >> c.nmdg;
cout << "\n \tEnter NEW SCIENTEFIC
NAME ";
cin >> c.real;
cout << "\n\t Enter Manufacturing
Price : Rs.";
cin >> c.mp;
cout << "\n\t Enter Selling Price :
Rs.";
cin >> c.sp;

f2.write ((char *) &c, sizeof (c));


}
else
{
f2.write ((char *) &c, sizeof (c));
}
f1.read ((char *) &c, sizeof (c));

f1.close ();
f2.close ();
remove ("drug.dat");
rename ("out.dat", "drug.dat");
if (flag1 == 1)
{
cout << "\nRECORD MODIFIED
SUCCESSFULLY. ";
}
else
{
cout << "\n\n Sorry record not
found!!! ";
}
}
//____________TO
PLACE OREDER FOR DRUG____________//
void order ()
{
clrscr();
pharm c(0,0,0);
int flag;
int n, amt, sum=0;
char ans = 'y';
fstream f1 ("drug.dat", ios::in);
f1.seekg (0);
disp ();

do
{
cout << "\nEnter the drug number you
want to order." << endl;
cin >> n;

cout << "Enter the amount of drug


needed." << endl;
cin >> amt;
while (f1.read ((char *) &c, sizeof
(c)))
{
if (c.no == n)
{
flag = 1;
cout << "\nDETAILS:" << endl;
cout <<"\n DRUG NUMBER |
\t DRUG NAME | \t SELLING PRICE :"<< endl;
cout <<"\n " << c.no << "\t\t
| \t" << c.nmdg << "\t\t | \t " << c.sp << endl;

sum = sum + (amt * c.sp);


break;
}

if (flag == 0)
{
cout << "\n\n Sorry record not
found !!!";
}
}
cout << "Do you want to order more
drugs ?(y/n)";
cin >> ans;
}
while (ans != 'n');

cout << "\n Your final bill is :Rs." << sum << endl;
f1.close ();

//_______________TO CONTACT THE COMPANY_______________//


void contact ()
{
clrscr();
cout << "---------> WE ARE TERASOL PHARMA <--------- "<< "\n";
cout << " HERE PRESENTING BEFORE YOU, THE WORLD'S BEST THEREPY "<< endl;
cout << " CONTACT US AT 9000988811 " << endl;
cout << " EMAIL PROVIDED : therepyTera@gmail.com " <<endl;
cout << " ADDRESS : Chocolate Factory road,Stage 2,BTM layout,Bangalore,560076
"<< endl;
}
//______________________OPTIONS_______________________//
void menu ()
{

clrscr();
char ans = 'y';
int k;
cout << endl << endl << endl << endl;
cout <<"\t::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<< endl;
cout <<"\t:: 'PROVIDED MENU OPTIONS' ::"<< endl;
cout <<"\t:: Enter 1 to go to ADMIN MENU ::"<< endl;
cout <<"\t:: Enter 2 to go to CUSTOMER MENU ::"<< endl;
cout <<"\t:: Enter any other number to EXIT ::"<< endl;
cout <<"\t::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<< endl;
cin >> k;

switch (k)
{
case 1:
admin ();
break;
case 2:
customer ();
break;
default:
cout << " INVALID OPTION" <<
endl;
cout << "Do you want to exit the
program ? Enter y or Y to exit." <<
endl;
cin >> ans;

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


break;
}

//____________FOR
ADMINS____________//
void admin ()
{

clrscr();
int k;
char ans = 'y';

do
{
cout << endl << endl << endl << endl <<
endl << endl << endl;
cout
<<"\t:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" <<endl;
cout <<"\t:: YOUR
CUSTOMIZED ADMIN MENU ::" <<endl;
cout <<"\t:: ENTER 1 : ADD
::" <<endl;
cout <<"\t:: ENTER 2 :
SEARCH ::" <<endl;
cout <<"\t:: ENTER 3 :
DELETE ::" <<endl;
cout <<"\t:: ENTER 4 :
MODIFY ::" <<endl;
cout <<"\t:: ENTER 5 :
DISPLAY ::" <<endl;
cout <<"\t:: ENTER 6 : Exit from
ADMIN MENU ::" <<endl;
cout <<"\t:: YOUR CHOICE
? ::" <<endl;
cout
<<"\t:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" <<endl;
cin >> k;

switch (k)
{
case 1:
add ();
break;
case 2:
search ();
break;
case 3:
del ();
break;
case 4:
modify ();
break;
case 5:
display ();
break;
case 6:
menu ();
break;
default:
cout << " errrr
>_<..>_<..>_<..>_< errrr "<< endl;
cout << " ENTER BETWEEN 1 AND
5 FOR AVAILABLE OPTIOPNS"<< endl;
break;
}
cout << "\tWANT TO GO FOR MORE
OPTION(y/n) ??" <<endl;
cin >> ans;
}
while (ans == 'y' || ans == 'Y');

}
//_______________FOR CUSTOMERS_________________//
void customer ()
{

clrscr();
int k;
char ans = 'y';

do
{
cout << endl << endl << endl << endl
<< endl << endl << endl;
cout <<
"\t:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" <<endl;
cout << "\t::
CUSTOMIZED CUSTOMER MENU ::" <<endl;
cout << "\t:: ENTER
1 : ORDER ::" << endl;
cout << "\t:: ENTER
2 : SEARCH ::" << endl;
cout << "\t:: ENTER
3 : DISPLAY ::" << endl;
cout << "\t:: ENTER 4
: CONATACT ::" << endl;
cout << "\t:: ENTER 5 :
Exit from CUSTOMER MENU ::" << endl;
cout << "\t:: YOUR
CHOICE ? ::" << endl;
cout <<
"\t:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" <<endl;
cin >> k;
switch (k)
{
case 1:
order ();
break;
case 2:
search ();
break ;
case 3:
disp ();
break;
case 4:
contact ();
break;
case 5:
menu ();
break;
default:
cout << "\n Error.....Enter
from 1 to 5" << endl;
break;
}
cout << "Want to do more?(y/n)" <<
endl;
cin >> ans;
}
while (ans == 'y' || ans == 'Y');
}
};

int main ()
{
pharm a(0,0,0);
a.comp ();
a.areainf ();
a.menu ();
return 0;
}

Вам также может понравиться