Академический Документы
Профессиональный Документы
Культура Документы
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
‘Pharmaceutical
Company’
with all included concepts of C++ with
the help of our Computer Science teacher,
Mr. Vinod Mishra for session 2019-20.
Class: XII-A
INTRODUCTION
Function purpose
name
1) VOID COMP() IT’S USED FOR WELCOME
MESSAGE OF COMNPANY.
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 ()
{
void areainf ()
{
}
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)))
{
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 ();
}
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 ();
}
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";
}
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;
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;
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 ();
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;
//____________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;
}