尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
………………………………………………………
………………………………………
Project Report
On
BLOOD DONATION
SYSTEM
…………………….
CLASS--XII
ACKNOWLEDGEMENT
I would like to convey my heartful thanks to
……………………… (Computer Science) who
always gave valuable suggestions & guidance for
completion of my project.
He helped me to understand & remember important
details of the project. My project has been a success
only because of his guidance.
I am especially indented & I am also beholden to my
friends. And finally I thank to the members of my
family for their support & encouragement.
CERTIFICATE
This is to certify that ……………………….. of
……… of
…………………………………………………
……. has completed his project under my
supervision. He has taken proper care & shown
sincerity in completion of this project.
I certify that this project is up to my
expectation & as per the guideline issued by
CBSE.
……………………………..
(Computer Science faculty )
Content
1. Introduction
2. Source Code
3. Output
4. Requirement
5. Advantages and disadvantages
6. Conclusion
7. System design
This project BLOOD DONATION SYSTEM includes some facilities for
the patients to search and get the required blood from the blood
bank and if there is no blood available for the patients the
blood bank provide the other group blood that is compatible
for the patients and the patient can also search the donors
according to their blood group and can directly contact to the
donors also on the basis of city or blood group.
This software keep the records of all the donors and their
information about how many time they donated the blood to
the blood bank with the dates of donation of blood.
The blood bank keeps the records of the patient to whom the
blood is given for the future records if needed by the
management.
//***************************************************************
// HEADER FILE USED IN PROJECT
//****************************************************************
#include<stdio.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
#include<ctype.h>
struct otherinfo
{
char mobno[15];
char email[70];
char bloodgroup[5];
char status;
};
//name structure
struct nameinfo
{
char fname[20];
char lname[20];
int age;
};
// address structure
struct address
{
int hno;
char city[35];
char state[15];
};
//date structure
struct dateinfo
{
int dd;
int mm;
int yy;
};
struct donardate
{
char donarreg[25];
dateinfo dt;
};
//******************FUNCTION PROTOTYPE****************
void intromain();
int getdonarno();
int checkpass();
void intro();
void donar_new_old();
void admin_menu();
void donar_menu();
char *getreg();
char *getpatno();
void donar_report_menu();
void display_bloodstock();
void write_donars();
void patients_menu();
void write_donar_ALREDYREG(char rgno[15]);
void displaydonarwithlist(char rgno[15]);
void displaybloodgroupwise(char bgp[5]);
void searchdonarcitywise(char city[15]);
void display_bloodavailable(char blgrp[5]);
int display_bloodavailable2(char blgrp[5]);
void modify_donarinfo(char regno[5]);
void patients_menu(char brg[5]);
void write_bloodstock(char bldgr[5]);
void decrease_bloodstock(char bldgr[5]);
void patients_menu(char brg[5]);
void displaypatientdetails(dateinfo bgp);
void delete_donarinfo(char regno[5]);
//******************FUNCTION PROTOTYPE****************
//****************CREATE FUNTION TO DISPLAY LIST OF DONARS BLOOD DONATION
void donarlist(int c,donardate donardt,int y,int no)
{
//gotoxy(5,13);
//cout<<"-S.NO.-DONATION DATES-||-S.NO.-DONATION DATES-||-S.NO.-DONATION DATES-";
int xx[3]={2,26,50};
gotoxy(xx[y],c);
cout<<"||-"<<no<<". - "<<donardt.dt.dd<<"/"<<donardt.dt.mm<<"/"<<donardt.dt.yy<<"||";
}
//blood stock class
struct storeblood
{
char blno[10];
char bloodgroup[5];
int qty;
};
//FILE NAME bloodstock.dat
void stockbloodonetime()
{
storeblood stockbl[8]={{"BL01","A+",1},{"BL02","A-",1},{"BL03","B+",1},{"BL04","B-",1},{"BL05","AB+",1},{"BL06","AB-",1},
{"BL07","O+",1},{"BL08","O-",1}};
ifstream objiff("bloodstock.dat",ios::binary);
storeblood st;
if(!objiff)
{
gotoxy(10,20);
cout<<"File could not be open !! Press any Key...";
getch();
ofstream objoff("bloodstock.dat",ios::binary);
clrscr();
intromain();
for(int x=0;x<8;x++)
{
st=stockbl[x];
objoff.write((char*)&st,sizeof(storeblood));
}
objoff.close();
}
clrscr();
intromain();
gotoxy(5,7);
cout<<"----------------The Blood Group System-------------------------";
gotoxy(2,8);
cout<<"There are four major blood groups determined by the presence or";
gotoxy(2,9);
cout<<"absence of two antigens – A and B – on the surface of red blood cells:";
gotoxy(2,11);
cout<<"Group A – has only the A antigen on red cells (and B antibody in the plasma)";
gotoxy(2,13);
cout<<"Group B – has only the B antigen on red cells (and A antibody in the plasma)";
gotoxy(2,15);
cout<<"Group AB – has both A and B antigens on red cells (but neither A nor B antibody in the plasma)";
gotoxy(2,18);
cout<<"Group O – has neither A nor B antigens on red cells (but both A and B antibody are in the plasma)";
gotoxy(5,20);
cout<<"================================================================";
objiff.close();
}
//***************donar's class**********************************
class donar
{
int dono;
char donar_regist[15];
nameinfo nm;
address add;
dateinfo date1;
otherinfo other;
public:
donar()
{
dono=0;
};
//*********set all the variables
void setfullname(nameinfo n)
{
strcpy(nm.fname,n.fname);
strcpy(nm.lname,n.lname);
}
void setage(int ag)
{
nm.age=ag;
}
void setaddress(address ad1)
{
add.hno=ad1.hno;
strcpy(add.city,ad1.city);
strcpy(add.state,ad1.state);
}
void setmobileno(char mb[15])
{
strcpy(other.mobno,mb);
}
void setemail(char eid[75])
{
strcpy(other.email,eid);
}
void setblodgrp(char bg[5])
{
strcpy(other.bloodgroup,bg);
}
//*********set all the variables
char *getdonarreg()
{
return donar_regist;
}
dateinfo getdate()
{
return date1;
}
char *getbloodname()
{
return other.bloodgroup;
}
//input fuction for donar information
void create_donar(int dn1)
{
gotoxy(5,7);
cout<<"======================================================================";
gotoxy(1,8);
cout<<"DONAR NO:";
dono=dn1;
gotoxy(10,8);
cout<<dono;
gotoxy(20,8);
cout<<"DONAR/'S REGISTRATION:";
gotoxy(48,8);
cin>>donar_regist;
gotoxy(20,9);
cout<<"FIRST NAME:";
gotoxy(32,9);
cin>>nm.fname;
gotoxy(48,9);
cout<<"LAST NAME:";
gotoxy(60,9);
cin>>nm.lname;
gotoxy(10,10);
cout<<"AGE:";
gotoxy(20,10);
cin>>nm.age;
gotoxy(10,11);
cout<<"-----------------DONAR'S ADDRESS DETAIL'S---------------------";
gotoxy(1,13);
cout<<"HOUSE NO:";
gotoxy(12,13);
cin>>add.hno;
gotoxy(18,13);
cout<<"city:";
gotoxy(30,13);
cin>>add.city;
gotoxy(55,13);
cout<<"STATE:";
gotoxy(65,13);
cin>>add.state;
gotoxy(10,15);
cout<<"-----------------DATE OF BLOOD DONATION----------------------";
gotoxy(10,16);
cout<<"DATE(dd/mm/yyyy):";
gotoxy(30,16);
cin>>date1.dd;
gotoxy(35,16);
cout<<"/";
gotoxy(40,16);
cin>>date1.mm;
gotoxy(45,16);
cout<<"/";
gotoxy(50,16);
cin>>date1.yy;
gotoxy(10,18);
cout<<"-----------------OTHER INFORMATION----------------------";
gotoxy(1,19);
cout<<"MOBILE NO:";
gotoxy(15,19);
cin>>other.mobno;
gotoxy(1,20);
cout<<"E-MAIL(IF NO ENTER "NO"):";
gotoxy(30,20);
cin>>other.email;
if(strcmp(other.email,"NO")==0||strcmp(other.email,"no")==0)
strcpy(other.email,"NO EMAIL ID");
gotoxy(1,21);
cout<<"BLOOD GROUP(A+ , A- , B+ , B- , O+ , O- , AB+ , AB- ):";
gotoxy(5,22);
cin>>other.bloodgroup;
other.status='Y';
}
//input fuction for donar information
//****************display donars information in a box
void display_donar_rectangle()
{
gotoxy(5,7);
cout<<"======================================================================";
gotoxy(1,8);
cout<<"DONAR REG:";
gotoxy(12,8);
cout<<donar_regist;
gotoxy(25,8);
cout<<"NAME:";
gotoxy(30,8);
cout<<" "<<nm.fname;
gotoxy(40,8);
cout<<"- "<<nm.lname;
gotoxy(60,8);
cout<<"AGE:";
gotoxy(65,8);
cout<<nm.age;
gotoxy(1,9);
cout<<"ADDRESS::";
gotoxy(10,9);
cout<<add.hno<<"-";
gotoxy(15,9);
cout<<add.city;
cout<<","<<add.state;
gotoxy(1,10);
cout<<"MOBILE NO:";
gotoxy(12,10);
cout<<other.mobno;
gotoxy(1,11);
cout<<"E-MAIL:";
gotoxy(10,11);
cout<<other.email;
gotoxy(40,10);
cout<<"BLOOD GROUP:";
gotoxy(60,10);
cout<<other.bloodgroup;
gotoxy(5,12);
cout<<"======================================================================";
}
//****************show all donars with blood groups row wise
void showalldonarsrowwise(int c)
{
gotoxy(1,c);
cout<<donar_regist<<setw(8)<<nm.fname<<"-"<<nm.lname<<setw(10)<<nm.age<<setw(5)<<add.hno<<"-"<<add.city<<","<<a
dd.state<<setw(15)<<other.mobno<<setw(5)<<other.bloodgroup;
gotoxy(1,c+1);
cout<<"------------------------------------------------------------------------";
}
//****************show all donars with blood groups row wise
int getdono()
{
return dono;
}
char *getfname()
{
return nm.fname;
}
char *getgroup()
{
return other.bloodgroup;
}
char *getcity()
{
return add.city;
}
char getstatus()
{
return other.status;
}
};
//***************donar's class**********************************
//**************
//***************patient's class**********************************
class patient
{
char pno[15];
nameinfo pnm;
address padd;
otherinfo pother;
int no_of_bottle;
dateinfo pdate1;
public:
//****************show all donars with blood groups row wise
void showallpatientsrowwise(int c)
{
gotoxy(1,c);
cout<<pno<<setw(8)<<pnm.fname<<"-"<<pnm.lname<<setw(10)<<pnm.age<<setw(5)<<padd.hno<<"-"<<padd.city<<","<<pad
d.state<<setw(15)<<pother.mobno<<setw(5)<<pother.bloodgroup;
gotoxy(1,c+1);
cout<<"------------------------------------------------------------------------";
}
//****************show all donars with blood groups row wise
//input fuction for patients information
void create_patient(char bloodgr[5])
{
gotoxy(5,7);
cout<<"====================PATIENT'S INFORMATION==============================";
gotoxy(1,8);
cout<<"PAT.NO:";
gotoxy(10,8);
cin>>pno;
gotoxy(20,8);
cout<<"FIRST NAME:";
gotoxy(32,8);
cin>>pnm.fname;
gotoxy(48,8);
cout<<"LAST NAME:";
gotoxy(60,8);
cin>>pnm.lname;
gotoxy(10,9);
cout<<"AGE:";
gotoxy(20,9);
cin>>pnm.age;
gotoxy(10,10);
cout<<"-----------------PATIENT'S ADDRESS DETAIL'S---------------------";
gotoxy(1,12);
cout<<"HOUSE NO:";
gotoxy(12,12);
cin>>padd.hno;
gotoxy(18,12);
cout<<"ADDRESS:";
gotoxy(30,12);
cin>>padd.city;
gotoxy(55,12);
cout<<"STATE:";
gotoxy(65,12);
cin>>padd.state;
gotoxy(10,14);
cout<<"-----------------DATE OF BLOOD GIVEN TO PATIENT--------------------";
gotoxy(10,15);
cout<<"DATE(dd/mm/yyyy):";
gotoxy(30,15);
cin>>pdate1.dd;
gotoxy(35,15);
cout<<"/";
gotoxy(40,15);
cin>>pdate1.mm;
gotoxy(45,15);
cout<<"/";
gotoxy(50,15);
cin>>pdate1.yy;
gotoxy(10,17);
cout<<"-----------------OTHER INFORMATION----------------------";
gotoxy(1,18);
cout<<"MOBILE NO:";
gotoxy(15,18);
cin>>pother.mobno;
gotoxy(1,19);
cout<<"E-MAIL(IF NO ENTER "NO"):";
gotoxy(30,19);
cin.getline(pother.email,70);
if(strcmp(pother.email,"NO")==0||strcmp(pother.email,"no")==0)
strcpy(pother.email,"NO EMAIL ID");
gotoxy(1,20);
no_of_bottle=1;
strcpy(pother.bloodgroup,bloodgr);;
pother.status='Y';
}
//input fuction for patients information
char *getpno()
{
return pno;
}
dateinfo getdate()
{
return pdate1;
}
int pdd()
{
return pdate1.dd;
}
int pmm()
{
return pdate1.mm;
}
int pyy()
{
return pdate1.yy;
}
char getstatus()
{
return pother.status;
}
};
//***************patient's class**********************************
//***************blood storage class**********************************
class bloodstore
{
int blstno;
char bloodgroup[5];
int qty;
char status;
public:
void add_bloodstore(int blno,char blgr[5],int qtty)
{
blstno=blno;
strcpy(bloodgroup,blgr);
qty=qtty;
status='Y';
}
void setbloodqty()
{
qty=qty+1;
}
int getblstno()
{
return blstno;
}
int getqty()
{
return qty;
}
char getstatus()
{
return status;
}
char *getbloodgroup()
{
return bloodgroup;
}
};
//***************blood storage class**********************************
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
void main()
{
char ch;
intro();
if(checkpass()==0)
{
do
{
//****************TEMPORARY***********************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================MAIN MENU====================";
gotoxy(28,7);
cout<<"01. BLOOD DONATION INFO./creating blood qty file";
gotoxy(28,8);
cout<<"02. ADMINISTRATOR";
gotoxy(28,9);
cout<<"03. EXIT";
gotoxy(20,10);
cout<<"==============================================";
gotoxy(25,12);
cout<<"Please Select Your Option (1-3) ";
gotoxy(30,14);
ch=getche();
switch(ch)
{
case '1': clrscr();
stockbloodonetime();
getch();
break;
case '2': admin_menu();
break;
case '3':exit(0);
default :cout<<"a";
}
}while(ch!='3');
}else
{
exit(0);
}
}
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
//***************main intro
void intromain()
{ clrscr();
gotoxy(1,2);
cout<<"*************************BLOOD******DONATION********SYSTEM********************";
gotoxy(1,3);
cout<<"******************************************************************************";
}
//***************main intro
//******************************login name and password****************
int checkpass()
{
char nm[20];
char pass[10];
clrscr();
intromain();
gotoxy(20,20);
cout<<"PLEASE ENTER THE USER NAME:";
gotoxy(20,21);
cin>>nm;
clrscr();
gotoxy(20,20);
cout<<"PLEASE ENTER THE PASSWORD:";
gotoxy(20,21);
cin>>pass;
if(strcmp(nm,"admin")==0 && strcmp(pass,"vicky")==0)
{
return 0;
}else
{
return 1;
}
}
//********************************************************************
//***************************************************************
// INTRODUCTION FUNCTION
//****************************************************************
void intro()
{ clrscr();
gotoxy(4,2);
cout<<"****************************BLOOD DONATION******************************";
gotoxy(12,4);
cout<<"===========================================================";
gotoxy(5,5);
cout<<"****************************S=Y=S=T=E=M********************************";
gotoxy(50,10);
cout<<"PROJECT:";
gotoxy(50,12);
cout<<"MADE BY : --------------------";
gotoxy(10,14);
cout<<"---------------CLASS : XII A--------------------";
getch();
}
//***************************************************************
// ADMINSTRATOR MENU FUNCTION
//****************************************************************
void admin_menu()
{
clrscr();
char ch2;
//int num;
//************************************************************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================ADMIN MENU====================";
gotoxy(22,7);
cout<<"1.DONAR INFORMATION";
gotoxy(22,8);
cout<<"2.BLOOD TO PATIENTS INFORMATION";
gotoxy(22,9);
cout<<"3.REPORTS";
gotoxy(22,10);
cout<<"4.BACK TO MAIN MENU";
gotoxy(22,11);
cout<<"Please Enter Your Choice (1-4) ";
gotoxy(22,12);
//**********************************************************
ch2=getche();
switch(ch2)
{
case '1':
donar_menu();
break;
case '2':
//*****************search for blood
char bldgroup[15];
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE BLOOD GROUP(QTY) TO BE SEARCHED(WITH COMPATIBILITY):";
gotoxy(55,9);
cin>>bldgroup;
//display_bloodavailable(bldgroup);
if(display_bloodavailable2(bldgroup)==0)
{
patients_menu(bldgroup);
}else
{
gotoxy(5,18);
cout<<"SORRY BLOOD NOT IN STOCK";
}
break;
case '3':
donar_report_menu();
break;
default:
cout<<"a";//admin_menu();
}
}
//***************************************************************
// DONARS INFORMATION ADD / MODIFY / DELETE
//****************************************************************
void donar_menu()
{
clrscr();
char ch2;
char regno[5];
//************************************************************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================DONAR'S MENU====================";
gotoxy(22,7);
cout<<"1.ADD DONAR INFORMATION";
gotoxy(22,8);
cout<<"2.MODIFY DONAR INFORMATION";
gotoxy(22,9);
cout<<"3.DELETE DONAR INFORMATION";
gotoxy(22,10);
cout<<"4.BACK TO MAIN MENU";
gotoxy(22,11);
cout<<"Please Enter Your Choice (1-4) ";
gotoxy(22,12);
//**********************************************************
ch2=getche();
switch(ch2)
{
case '1': clrscr();
donar_new_old();
break;
case '2':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED:";
gotoxy(55,9);
cin>>regno;
modify_donarinfo(regno);
break;
case '3':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED AND DELETE:";
gotoxy(55,9);
cin>>regno;
delete_donarinfo(regno);
break;
default:
cout<<"a";//admin_menu();
}
}
//***************************************************************
//*************donars registration or already registered
void donar_new_old()
{
clrscr();
char ch2;
//int num;
char regno[15];
//************************************************************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================DONAR'S MENU====================";
gotoxy(22,7);
cout<<"1.NEW DONAR REGISTRATION";
gotoxy(22,8);
cout<<"2.ALREADY REGISTERED";
gotoxy(22,9);
cout<<"3.BACK TO MAIN MENU";
gotoxy(22,10);
cout<<"Please Enter Your Choice (1-4) ";
gotoxy(22,11);
//**********************************************************
ch2=getche();
switch(ch2)
{
case '1': clrscr();
write_donars();
break;
case '2':
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================ALREADY REGISTERED====================";
gotoxy(5,7);
cout<<"ENTER THE DONARS REGISTERED NO:";
gotoxy(40,7);
cin>>regno;
write_donar_ALREDYREG(regno);
break;
default:
cout<<"a";//admin_menu();
}
}
//*************donars registration or already registered
//***************************************************************
// donar's reports
//****************************************************************
void donar_report_menu()
{
clrscr();
char ch2;
char regno[15];
char bldgroup[5],cty[35];
dateinfo dtvalue2;
//************************************************************
clrscr();
intromain();
gotoxy(20,6);
cout<<"=================REPORTS====================";
gotoxy(22,7);
cout<<"1.ALL DONAR INFORMATION BLOOD GROUP WISE";
gotoxy(22,8);
cout<<"2.ALL DONAR INFORMATION CITY WISE";
gotoxy(22,9);
cout<<"3.ALL BLOOD GROUP WITH AVAILABILITY";
gotoxy(22,10);
cout<<"4.DISPLAY DONAR INFORMATION WITH DATE OF DONATIONS";
gotoxy(22,11);
cout<<"5.DISPLAY PATIENTS INFORMATION WITH BLOOD INFO. DATE WISE";
gotoxy(22,12);
cout<<"6.DISPLAY BLOOD GROUP WITH QUANTITY";
gotoxy(22,13);
cout<<"7.BACK TO MAIN MENU";
gotoxy(22,14);
cout<<"Please Enter Your Choice (1-7) ";
gotoxy(22,15);
//**********************************************************
ch2=getche();
switch(ch2)
{
case '1':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE BLOOD GROUP TO BE SEARCHED(WITH COMPATIBILITY):";
gotoxy(55,9);
cin>>bldgroup;
displaybloodgroupwise(bldgroup);
break;
case '2':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE CITY WISE SEARCH OF DONARS:";
gotoxy(55,9);
cin>>cty;
searchdonarcitywise(cty);
break;
case '6':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE BLOOD GROUP(QTY) TO BE SEARCHED(WITH COMPATIBILITY):";
gotoxy(55,9);
cin>>bldgroup;
display_bloodavailable(bldgroup);
break;
case '4':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED:";
gotoxy(55,9);
cin>>regno;
displaydonarwithlist(regno);
break;
case '5':
clrscr();
intromain();
gotoxy(10,8);
cout<<"*****ENTER THE DATE OF BLOOD GIVEN TO PATIENTS:";
gotoxy(10,10);
cout<<"DATE(dd/mm/yyyy):";
gotoxy(30,10);
cin>>dtvalue2.dd;
gotoxy(35,10);
cout<<"/";
gotoxy(40,10);
cin>>dtvalue2.mm;
gotoxy(45,10);
cout<<"/";
gotoxy(50,10);
cin>>dtvalue2.yy;
displaypatientdetails(dtvalue2);
break;
case '3':
display_bloodstock();
default:
cout<<"a";//admin_menu();
}
}
//*****************add new registered donars information
void write_donars()
{
ofstream objoff;
donar donarobj;
donardate donalist;
objoff.open("donars.dat",ios::binary|ios::app);
ofstream objofflist("donarlist.dat",ios::binary|ios::app);
clrscr();
intromain();
int rnn=getdonarno();
char getprv_regno[15];
strcpy(getprv_regno,getreg());
if(strcmp(getprv_regno,"NULL")!=0)
{
gotoxy(5,4);
cout<<"Previous REGNO: "<<getprv_regno;
}
if(rnn>10000)
{
rnn=1;
}
donarobj.create_donar(rnn);
objoff.write((char*)&donarobj,sizeof(donarobj));
//************write to donar list also
strcpy(donalist.donarreg,donarobj.getdonarreg());
donalist.dt=donarobj.getdate();
objofflist.write((char*)&donalist,sizeof(donalist));
objoff.close();
objofflist.close();
gotoxy(10,24);
cout<<"***************DONARS RECORD SAVED******************* ";
//********send the blood group to the bloodstock file
write_bloodstock(donarobj.getbloodname());
//************************************************
cin.ignore();
getch();
}
//*****************add new registered donars information
//************get thje donars last number****************
char *getreg()
{
ifstream objiff;
donar st;
int count=0;
char tmpregno[15];
objiff.open("donars.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
}
//**************temporary hiding these lines
while(objiff.read((char *) &st, sizeof(donar)))
{
count++;
}
//***********jump to the last line
objiff.seekg(count-sizeof(st),ios::beg);
objiff.read((char *) &st, sizeof(donar));
strcpy(tmpregno,st.getdonarreg());
objiff.close();
if(count!=0)
return tmpregno;
else
return "NULL";
}
//************get thje donars last number****************
//******************all the donars fuction details****************************
//******************generate the number
int getdonarno()
{
ifstream objiff;
donar st;
int count=0;
objiff.open("donars.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
}
//**************temporary hiding these lines
while(objiff.read((char *) &st, sizeof(donar)))
{
count++;
}
//***********jump to the last line
objiff.seekg(count-sizeof(st),ios::beg);
objiff.read((char *) &st, sizeof(donar));
count=st.getdono();
count++;
objiff.close();
return count;
}
//****************generate the donars number
//**************write the donars dates who is already registered
void write_donar_ALREDYREG(char rgno[15])
{
/*
struct donardate
{
char donarreg[25];
dateinfo dt;
};
*/
dateinfo date1;
donar dr;
int flag=0;
donardate donalist;
ifstream fp;
fp.open("donars.dat",ios::binary);
ofstream objoff("donarlist.dat",ios::binary|ios::app);
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),rgno)==0)
{
clrscr();
intromain();
dr.display_donar_rectangle();
flag=1;
strcpy(donalist.donarreg,dr.getdonarreg());
}
}
fp.close();
if(flag==0)
{cout<<"nnrecord not exist";
getch();
}else
{
gotoxy(5,14);
cout<<"ENTER THE DATE OF BLOOD DOATION:";
gotoxy(10,16);
cout<<"DATE(dd/mm/yyyy):";
gotoxy(30,16);
cin>>date1.dd;
gotoxy(35,16);
cout<<"/";
gotoxy(40,16);
cin>>date1.mm;
gotoxy(45,16);
cout<<"/";
gotoxy(50,16);
cin>>date1.yy;
donalist.dt.dd=date1.dd;
donalist.dt.mm=date1.mm;
donalist.dt.yy=date1.yy;
objoff.write((char*)&donalist,sizeof(donalist));
objoff.close();
//********send the blood group to the bloodstock file
write_bloodstock(dr.getbloodname());
//************************************************
}
}
//**************write the donars dates who is already registered
//**********donar name and list of blood donation
void displaydonarwithlist(char rgno[15])
{
ifstream fp;
fp.open("donars.dat",ios::binary);
ifstream objiff("donarlist.dat",ios::binary);
donardate donalist;
donar dr;
int flag=-1;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),rgno)==0)
{
clrscr();
intromain();
dr.display_donar_rectangle();
flag=1;
strcpy(donalist.donarreg,dr.getdonarreg());
}
}
fp.close();
if(flag==1)
{
gotoxy(5,13);
cout<<"-------------------LIST OF BLOOD DONATED BY DONAR---------------------";
int c1=14;
int no1=1;
int y1=0;
while(objiff.read((char*)&donalist,sizeof(donardate)))
{
if(strcmp(rgno,donalist.donarreg)==0)
{
if(y1<=2)
{
donarlist(c1,donalist,y1,no1);
y1++;
no1++;
}else
{
y1=0;
c1++;
no1++;
}
}
}
}
objiff.close();
getch();
}
//**********donar name and list of blood donation
//************blood stock list
void display_bloodstock()
{
ifstream objiff("bloodstock.dat",ios::binary);
storeblood blstk;
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
clrscr();
intromain();
int c1=5;
gotoxy(5,c1);
c1++;
cout<<"BLOODNO"<<setw(18)<<"BLOOD GROUP"<< setw(20)<<"QUANTITY";
while(objiff.read((char*)&blstk,sizeof(blstk)))
{
gotoxy(5,c1);
cout<<blstk.blno<<setw(18)<<blstk.bloodgroup<<setw(20)<<blstk.qty;
c1++;
}
objiff.close();
getch();
}
//************blood stock list
//*******************display blood group wise with compatibility
void displaybloodgroupwise(char bgp[5])
{
ifstream fp;
fp.open("donars.dat",ios::binary);
donar dr;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
clrscr();
intromain();
int c1=7;
gotoxy(1,5);
cout<<"REG No."<<setw(15)<<"NAME OF DONAR"<<setw(5)<<"AGE"<<setw(12)<<"------
ADDRESS-------"<<setw(18)<<"MOBILE NO."<<setw(12)<<"BLOOD GROUP";
gotoxy(1,6);
cout<<"========================================================================";
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),bgp)==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
fp.close();
fp.open("donars.dat",ios::binary);
gotoxy(1,c1);
cout<<"========================================================================";
c1++;
gotoxy(1,c1);
cout<<"==========OTHER BLOOD COMPATIBLE BLOOD GROUPS===========================";
c1++;
//-------for A+
if(strcmp(bgp,"A+")==0)
{
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),"A-")==0 ||strcmp(dr.getbloodname(),"O-")==0 || strcmp(dr.getbloodname(),"O+")==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
}
///for A-
else if(strcmp(bgp,"A-")==0 )
{
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),"O-")==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
}
//for B+
else if(strcmp(bgp,"B+")==0)
{
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),"B-")==0 ||strcmp(dr.getbloodname(),"O-")==0 || strcmp(dr.getbloodname(),"O+")==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
}
//**for B-
else if(strcmp(bgp,"B-")==0)
{
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),"B-")==0 ||strcmp(dr.getbloodname(),"O-")==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
}
//**for AB+
else if(strcmp(bgp,"AB+")==0)
{
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),"A+")==0 || strcmp(dr.getbloodname(),"A-")==0 || strcmp(dr.getbloodname(),"B+")==0 ||
strcmp(dr.getbloodname(),"B-")==0 || strcmp(dr.getbloodname(),"O+")==0 || strcmp(dr.getbloodname(),"O-")==0 ||
strcmp(dr.getbloodname(),"AB-")==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
}
//**for AB-
else if(strcmp(bgp,"AB-")==0)
{
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),"O-")==0 ||strcmp(dr.getbloodname(),"A-")==0 ||strcmp(dr.getbloodname(),"B-")==0 ||
strcmp(dr.getbloodname(),"AB-")==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
}
//**for O+
else if(strcmp(bgp,"O+")==0)
{
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getbloodname(),"O-")==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
}
//**for O-
else if(strcmp(bgp,"O-")==0)
{
gotoxy(5,c1);
cout<<"*****************ONLY O - *************************";
}
//**************************ends here************************
fp.close();
getch();
}
//*******************display blood group wise with compatibility
//***************donars information city wise
void searchdonarcitywise(char city[15])
{
ifstream fp;
fp.open("donars.dat",ios::binary);
donar dr;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
clrscr();
intromain();
int c1=7;
gotoxy(1,5);
cout<<"REG No."<<setw(15)<<"NAME OF DONAR"<<setw(5)<<"AGE"<<setw(12)<<"------
ADDRESS-------"<<setw(18)<<"MOBILE NO."<<setw(12)<<"BLOOD GROUP";
gotoxy(1,6);
cout<<"========================================================================";
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getcity(),city)==0)
{
dr.showalldonarsrowwise(c1);
c1++;
}
}
fp.close();
getch();
}
//***************donars information city wise
//**************search and display the avaliblity of blood
void display_bloodavailable(char blgrp[5])
{
ifstream objiff("bloodstock.dat",ios::binary);
storeblood blstk;
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
clrscr();
intromain();
int c1=5;
gotoxy(5,c1);
c1++;
cout<<"BLOODNO"<<setw(18)<<"BLOOD GROUP"<< setw(20)<<"QUANTITY";
while(objiff.read((char*)&blstk,sizeof(blstk)))
{
if( strcmp(blstk.bloodgroup,blgrp)==0)
{
gotoxy(5,c1);
cout<<blstk.blno<<setw(18)<<blstk.bloodgroup<<setw(20)<<blstk.qty;
c1++;
}
}
objiff.close();
//*******************main ends here
ifstream fp;
fp.open("bloodstock.dat",ios::binary);
storeblood dr;
gotoxy(1,c1);
cout<<"========================================================================";
c1++;
gotoxy(1,c1);
cout<<"==========OTHER BLOOD COMPATIBLE BLOOD GROUPS===========================";
c1++;
//-------for A+
if(strcmp(blgrp,"A+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if(strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"O+")==0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
}
}
}
///for A-
else if(strcmp(blgrp,"A-")==0 )
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if(strcmp(dr.bloodgroup,"O-")==0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
}
}
}
//for B+
else if(strcmp(blgrp,"B+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if(strcmp(dr.bloodgroup,"B-")==0 ||strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"O+")==0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
}
}
}
//**for B-
else if(strcmp(blgrp,"B-")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if(strcmp(dr.bloodgroup,"B-")==0 ||strcmp(dr.bloodgroup,"O-")==0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
}
}
}
//**for AB+
else if(strcmp(blgrp,"AB+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if(strcmp(dr.bloodgroup,"A+")==0 || strcmp(dr.bloodgroup,"A-")==0 || strcmp(dr.bloodgroup,"B+")==0 ||
strcmp(dr.bloodgroup,"B-")==0 || strcmp(dr.bloodgroup,"O+")==0 || strcmp(dr.bloodgroup,"O-")==0 ||
strcmp(dr.bloodgroup,"AB-")==0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
}
}
}
//**for AB-
else if(strcmp(blgrp,"AB-")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if(strcmp(dr.bloodgroup,"O-")==0 ||strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"B-")==0 ||
strcmp(dr.bloodgroup,"AB-")==0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
}
}
}
//**for O+
else if(strcmp(blgrp,"O+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if(strcmp(dr.bloodgroup,"O-")==0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
}
}
}
//**for O-
else if(strcmp(blgrp,"O-")==0)
{
gotoxy(5,c1);
cout<<"*****************ONLY O - *************************";
}
//**************************ends here************************
fp.close();
getch();
//******************compatibility ends here
}
//**************search and display the avaliblity of blood
//***************delete donars information
void delete_donarinfo(char regno[5])
{
clrscr();
intromain();
ifstream fp;
donar dr;
int flag=0;
fp.open("donars.dat",ios::binary);
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),regno)==0)
{
flag=1;
//fpos=(int)fp.tellg();
break;
}
}
char ch;
if(flag==0)
{ cout<<"nnrecord not exist";
fp.close();
}else
{
// fp.seekp(fpos-sizeof(donar),ios::beg);
dr.display_donar_rectangle();
fp.close();
//*******deletion of the records starts from here
gotoxy(1,15);
cout<<"*****************************************************************************";
gotoxy(5,16);
cout<<"======DO YOU WANT TO DELETE THE RECORDS GIVEN ABOVE[YES(Y) OR NO (N)========";
gotoxy(2,17);
cin>>ch;
if (toupper(ch)=='Y')
{
ofstream outFile;
outFile.open("Temp1.dat",ios::binary);
ifstream objiff("donars.dat",ios::binary);
objiff.seekg(0,ios::beg);
while(objiff.read((char *) &dr, sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),regno)!=0)
{
outFile.write((char *) &dr, sizeof(donar));
}
}
outFile.close();
objiff.close();
remove("donars.dat");
rename("Temp1.dat","donars.dat");
//againopenandclose();
gotoxy(30,20);
cout<<"----------------------------Record Deleted----------------------------------";
getch();
}
}
//***********************delete record ends************************************
}
//***************delete donars information
//****************modification of donar information
void modify_donarinfo(char regno[5])
{
char ch2;
clrscr();
intromain();
fstream fp;
fp.open("donars.dat",ios::binary|ios::in|ios::out);
//donardate donalist;
donar dr;
nameinfo nminfo;
address ad1;
char mb[15],eid[75],bg[5];
int fpos=-1,ag=0;
int flag=-1,flagblood=-1;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(fp.read((char*)&dr,sizeof(donar)))
{
if(strcmp(dr.getdonarreg(),regno)==0)
{
//clrscr();
//intromain();
//dr.display_donar_rectangle();
flag=1;
//strcpy(donalist.donarreg,dr.getdonarreg());
fpos=(int)fp.tellg();
break;
}
}
// fp.close();
if(flag==1)
{
fp.seekp(fpos-sizeof(donar),ios::beg);
dr.display_donar_rectangle();
//fp.write((char *) &dr, sizeof(donar));
//--------------------------------------------
gotoxy(20,13);
cout<<"==========DONAR'S MODIFICATION MENU====================";
gotoxy(22,14);
cout<<"1.MODIFY NAME";
gotoxy(22,15);
cout<<"2.MODIFY AGE";
gotoxy(22,16);
cout<<"3.MODIFY ADDRESS";
gotoxy(22,17);
cout<<"4.MODIFY MOBILE NO.";
gotoxy(22,18);
cout<<"5.MODIFY EMAIL";
gotoxy(22,19);
cout<<"6.MODIFY BLOOD GROUP";
//gotoxy(22,20);
//cout<<"7.BACK TO MAIN MENU";
gotoxy(22,21);
cout<<"Please Enter Your Choice (1-6) ";
gotoxy(22,22);
//**********************************************************
ch2=getche();
clrscr();
intromain();
dr.display_donar_rectangle();
switch(ch2)
{
case '1':
gotoxy(20,13);
cout<<"===ENTER THE FIRST NAME TO MODIFY: ";cin>>nminfo.fname;
gotoxy(20,14);
cout<<"===ENTER THE LAST NAME TO MODIFY: ";cin>>nminfo.lname;
dr.setfullname(nminfo);
break;
case '2':
gotoxy(20,13);
cout<<"===ENTER THE AGE TO MODIFY: ";cin>>ag;
dr.setage(ag);
break;
case '3':
gotoxy(20,13);
cout<<"===ENTER THE HNO TO MODIFY: ";cin>>ad1.hno;
gotoxy(20,14);
cout<<"===ENTER THE CITY TO MODIFY: ";cin>>ad1.city;
gotoxy(20,15);
cout<<"===ENTER THE STATE TO MODIFY: ";cin>>ad1.state;
dr.setaddress(ad1);
break;
case '4':
gotoxy(20,13);
cout<<"===ENTER THE MOBILE TO MODIFY: ";cin>>mb;
dr.setmobileno(mb);
break;
case '5':
gotoxy(20,13);
cout<<"===ENTER THE EMAIL TO MODIFY: ";cin>>eid;
dr.setemail(eid);
break;
case '6':
gotoxy(20,13);
cout<<"===ENTER THE BLOOD GROUP TO MODIFY: ";cin>>bg;
dr.setblodgrp(bg);
flagblood=1;
break;
default:
cout<<"a";//admin_menu();
}
fp.write((char *) &dr, sizeof(donar));
}
fp.close();
gotoxy(10,24);
if(flagblood==1)
{
gotoxy(20,15);
cout<<"old blood:"<<dr.getbloodname()<<" new blood::"<<bg;
write_bloodstock(bg);
decrease_bloodstock(dr.getbloodname());
flagblood=-1;
}
cout<<"*****************modified the record******************";
getch();
}
//****************increase the blood qty by 1
void write_bloodstock(char bldgr[5])
{
int fpos=-1;
fstream File;
storeblood st,tmp;
File.open("bloodstock.dat",ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(File)
{
File.read((char *) &st, sizeof(storeblood));
if(strcmp(st.bloodgroup,bldgr)==0)
{ fpos=(int)File.tellg();
break;
}
}
File.seekp(fpos-sizeof(storeblood));
tmp=st;
tmp.qty=tmp.qty+1;
File.write((char *) &tmp, sizeof(storeblood));
File.close();
}
//****************************************************************************
//****************decrease the blood stock by 1******************************
//****************increase the blood qty by 1
void decrease_bloodstock(char bldgr[5])
{
int fpos=-1;
fstream File;
storeblood st,tmp;
File.open("bloodstock.dat",ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
while(File.read((char *) &st, sizeof(storeblood)))
{
if(strcmp(st.bloodgroup,bldgr)==0)
{ fpos=(int)File.tellg();
break;
}
}
File.seekp(fpos-sizeof(storeblood),ios::beg);
tmp=st;
tmp.qty=tmp.qty-1;
File.write((char *) &tmp, sizeof(storeblood));
File.close();
}
//************************************************************************
//*************function to search for blood and compatibility and return true
int display_bloodavailable2(char blgrp[5])
{
int returnvalue=-1;
ifstream objiff("bloodstock.dat",ios::binary);
storeblood blstk;
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
//return;
}
clrscr();
intromain();
int c1=5;
gotoxy(5,c1);
c1++;
cout<<"BLOODNO"<<setw(18)<<"BLOOD GROUP"<< setw(20)<<"QUANTITY";
while(objiff.read((char*)&blstk,sizeof(blstk)))
{
if( strcmp(blstk.bloodgroup,blgrp)==0 && blstk.qty>0)
{
gotoxy(5,c1);
cout<<blstk.blno<<setw(18)<<blstk.bloodgroup<<setw(20)<<blstk.qty;
c1++;
returnvalue=0;
}
}
objiff.close();
//*******************main ends here
ifstream fp;
fp.open("bloodstock.dat",ios::binary);
storeblood dr;
gotoxy(1,c1);
cout<<"========================================================================";
c1++;
gotoxy(1,c1);
cout<<"==========OTHER BLOOD COMPATIBLE BLOOD GROUPS===========================";
c1++;
//-------for A+
if(strcmp(blgrp,"A+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"O+")==0) && dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
///for A-
else if(strcmp(blgrp,"A-")==0 )
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"O-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//for B+
else if(strcmp(blgrp,"B+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"B-")==0 ||strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"O+")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//**for B-
else if(strcmp(blgrp,"B-")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"B-")==0 ||strcmp(dr.bloodgroup,"O-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//**for AB+
else if(strcmp(blgrp,"AB+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"A+")==0 || strcmp(dr.bloodgroup,"A-")==0 || strcmp(dr.bloodgroup,"B+")==0 ||
strcmp(dr.bloodgroup,"B-")==0 || strcmp(dr.bloodgroup,"O+")==0 || strcmp(dr.bloodgroup,"O-")==0 ||
strcmp(dr.bloodgroup,"AB-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//**for AB-
else if(strcmp(blgrp,"AB-")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"O-")==0 ||strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"B-")==0 ||
strcmp(dr.bloodgroup,"AB-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//**for O+
else if(strcmp(blgrp,"O+")==0)
{
while(fp.read((char*)&dr,sizeof(storeblood)))
{
if((strcmp(dr.bloodgroup,"O-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty;
c1++;
returnvalue=0;
}
}
}
//**for O-
else if((strcmp(blgrp,"O-")==0)&& dr.qty>0)
{
gotoxy(5,c1);
cout<<"*****************ONLY O - *************************";
returnvalue=0;
}
//**************************ends here************************
fp.close();
return returnvalue;
//******************compatibility ends here
}
//*************function to search for blood and compatibility and return true
//************function to display all patients details date wise
void displaypatientdetails(dateinfo bgp)
{
ifstream fp;
fp.open("patientsinfo.dat",ios::binary);
patient dr;
if(!fp)
{
cout<<"File could not be open !! Press any Key...";
getch();
return;
}
clrscr();
intromain();
//***********display date
gotoxy(10,5);
cout<<"DATE(dd/mm/yyyy): "<<bgp.dd<<"/"<<bgp.mm<<"/"<<bgp.yy;
//**********************
int c1=9;
gotoxy(1,6);
cout<<"REG No."<<setw(15)<<"NAME OF PATIENT"<<setw(5)<<"AGE"<<setw(12)<<"------
ADDRESS-------"<<setw(18)<<"MOBILE NO."<<setw(12)<<"BLOOD GROUP";
gotoxy(1,7);
cout<<"========================================================================";
while(fp.read((char*)&dr,sizeof(patient)))
{
if(dr.pdd()==bgp.dd && dr.pmm()==bgp.mm && dr.pyy()==bgp.yy)
{
dr.showallpatientsrowwise(c1);
c1++;
}
}
fp.close();
getch();
}
//************function to display all patients details date wise
//***************************************************************
// patient's information
//***************************************************************
void patients_menu(char brg[5])
{
patient patobj;
ofstream objoff;
char getprv_patno[15];
objoff.open("patientsinfo.dat",ios::binary|ios::app);
//************************************************************
clrscr();
intromain();
strcpy(getprv_patno,getpatno());
if(strcmp(getprv_patno,"NULL")!=0)
{
gotoxy(5,4);
cout<<"Previous REGNO: "<<getprv_patno;
}
//**************************************
patobj.create_patient(brg);
objoff.write((char*)&patobj,sizeof(patient));
objoff.close();
//*********now decrease one from the stock of blood
clrscr();
intromain();
//***********check the available with compatibility and decrease one from it
display_bloodavailable(brg);
char blgroup[5];
//************************************************************************
gotoxy(10,15);
cout<<"Enter the blood group ::";
gotoxy(60,15);
cin>>blgroup;
decrease_bloodstock(blgroup);
//*********now decrease one from the stock of blood
getch();
}
//**************patient previous no
//************get thje donars last number****************
char *getpatno()
{
ifstream objiff;
patient st;
int count=0;
char tmpregno[15];
objiff.open("patientsinfo.dat",ios::binary);
objiff.seekg(0,ios::beg);
if(!objiff)
{
cout<<"File could not be open !! Press any Key...";
getch();
}
//**************temporary hiding these lines
while(objiff.read((char *) &st, sizeof(patient)))
{
count++;
}
//***********jump to the last line
objiff.seekg(count-sizeof(st),ios::beg);
objiff.read((char *) &st, sizeof(patient));
strcpy(tmpregno,st.getpno());
objiff.close();
if(count!=0)
return tmpregno;
else
return "NULL";
}
//************get thje donars last number****************
//**************patient previous no
//******************all the donars fuction details****************************
if choice is 1:
If choice 1 in sub menu:
Choice is 1
if choice 2:
if choice 2 modify the donars informtion:
If choice is 1: from the main menu
If choice is 3
Choice 1:
Choice 2:
Choice 3:
Choice 4:
Choice 5:
Choice 6:
REQUIREMENTS
HARDWARE REQUIRED
• Printer, to print the required documents of the project
• Compact Drive
• Processor : intel
• Ram : 512 MB or more than 512MB
• Harddisk : 80 GB or more than 80GB.
SOFTWARE REQUIRED
• Operating system : Windows XP
• Turbo C++, for execution of program and Ms word, for
presentation of output.
ADVANTAGES
• A patient does not need to wait in long queues.
• This software reduces paper work.
• It is easy to handle patient’s record.
• This software saves the time.
• Information of the donors stores permanently.
DISADVANTAGES
• This system suitable for only small blood banks.
• Online facility is not available.
CONCLUSION
This software is efficient in maintaining donor’s details and
can easily perform operations on blood donation’s records.
This software also reduces the work load of the blood bank
management to know how much blood is available and also
keep the records of how many patients get the blood from the
blood bank.
In future, this system can launch web site for easy online blood
banking system.
SYSTEM DESIGN
Then we began with the design phase of the system. System design is a solution, a
“HOW TO” approach to the creation of a new system. It translates system
requirements into ways by which they can be made operational. It is a
translational from a user oriented document to a document oriented
programmers. For that, it provides the understanding and procedural details
necessary for the implementation. Here we use Flowchart to supplement the
working of the new system. The system thus made should be reliable, durable and
above all should have least possible maintenance costs. It should overcome all the
drawbacks of the Old existing system and most important of all meet the user
requirements.
BLOOD DONATION SYSTEM IN C++

More Related Content

What's hot

SRS on Online Blood Bank Managment system...
SRS on Online Blood Bank Managment system... SRS on Online Blood Bank Managment system...
SRS on Online Blood Bank Managment system...
GCWUF
 
Banking Management System Project
Banking Management System ProjectBanking Management System Project
Banking Management System Project
Chaudhry Sajid
 
Blood Bank Management System
Blood Bank Management SystemBlood Bank Management System
Blood Bank Management System
Chirag N Jain
 
ONLINE BLOOD BANKING SYSTEM
ONLINE BLOOD BANKING SYSTEMONLINE BLOOD BANKING SYSTEM
ONLINE BLOOD BANKING SYSTEM
Akansha Soni
 
Online railway reservation system
Online railway reservation systemOnline railway reservation system
Online railway reservation system
PIYUSH Dubey
 
Blood Bank Management System (including UML diagrams)
Blood Bank Management System (including UML diagrams)Blood Bank Management System (including UML diagrams)
Blood Bank Management System (including UML diagrams)
Harshil Darji
 
Blood Bank(Web Application)
Blood Bank(Web Application)Blood Bank(Web Application)
Blood Bank(Web Application)
maheshkarthikd
 
Full report on blood bank management system
Full report on  blood bank management systemFull report on  blood bank management system
Full report on blood bank management system
Jawhar Ali
 
Library Management System in c++
Library Management System in c++Library Management System in c++
Library Management System in c++
vikram mahendra
 
Blood bank report new
Blood bank report newBlood bank report new
Blood bank report new
Armaan Pandita
 
Synopsis on railway reservation system
Synopsis on railway reservation systemSynopsis on railway reservation system
Synopsis on railway reservation system
Ankit Verma
 
ER diagrams for blood bank management system
ER diagrams for blood bank management systemER diagrams for blood bank management system
ER diagrams for blood bank management system
Soham Nanekar
 
Blood Bank Management System Project Proposal
Blood Bank Management System Project ProposalBlood Bank Management System Project Proposal
Blood Bank Management System Project Proposal
Azmeen Gadit
 
Movie Ticket Booking Website Project Presentation
Movie Ticket Booking Website Project PresentationMovie Ticket Booking Website Project Presentation
Movie Ticket Booking Website Project Presentation
Avinandan Ganguly
 
Blood Bank Management System by CDAC
Blood Bank Management System by CDACBlood Bank Management System by CDAC
Blood Bank Management System by CDAC
Saurav Gupta
 
Hospital Management System SRS
Hospital Management System SRSHospital Management System SRS
Hospital Management System SRS
Chandresh Prasad
 
Activity diagram for ticket vending machine
Activity diagram for ticket vending machineActivity diagram for ticket vending machine
Activity diagram for ticket vending machine
Yaswanth Babu Gummadivelli
 
Online Tours and travel
Online Tours and travelOnline Tours and travel
Online Tours and travel
Amit Patil
 
Project report on (atm MAnagment system)
Project report on (atm MAnagment system)Project report on (atm MAnagment system)
Project report on (atm MAnagment system)
Muhammad Umer Lari
 
Online Bus Reservation
Online Bus ReservationOnline Bus Reservation
Online Bus Reservation
Astha Patel
 

What's hot (20)

SRS on Online Blood Bank Managment system...
SRS on Online Blood Bank Managment system... SRS on Online Blood Bank Managment system...
SRS on Online Blood Bank Managment system...
 
Banking Management System Project
Banking Management System ProjectBanking Management System Project
Banking Management System Project
 
Blood Bank Management System
Blood Bank Management SystemBlood Bank Management System
Blood Bank Management System
 
ONLINE BLOOD BANKING SYSTEM
ONLINE BLOOD BANKING SYSTEMONLINE BLOOD BANKING SYSTEM
ONLINE BLOOD BANKING SYSTEM
 
Online railway reservation system
Online railway reservation systemOnline railway reservation system
Online railway reservation system
 
Blood Bank Management System (including UML diagrams)
Blood Bank Management System (including UML diagrams)Blood Bank Management System (including UML diagrams)
Blood Bank Management System (including UML diagrams)
 
Blood Bank(Web Application)
Blood Bank(Web Application)Blood Bank(Web Application)
Blood Bank(Web Application)
 
Full report on blood bank management system
Full report on  blood bank management systemFull report on  blood bank management system
Full report on blood bank management system
 
Library Management System in c++
Library Management System in c++Library Management System in c++
Library Management System in c++
 
Blood bank report new
Blood bank report newBlood bank report new
Blood bank report new
 
Synopsis on railway reservation system
Synopsis on railway reservation systemSynopsis on railway reservation system
Synopsis on railway reservation system
 
ER diagrams for blood bank management system
ER diagrams for blood bank management systemER diagrams for blood bank management system
ER diagrams for blood bank management system
 
Blood Bank Management System Project Proposal
Blood Bank Management System Project ProposalBlood Bank Management System Project Proposal
Blood Bank Management System Project Proposal
 
Movie Ticket Booking Website Project Presentation
Movie Ticket Booking Website Project PresentationMovie Ticket Booking Website Project Presentation
Movie Ticket Booking Website Project Presentation
 
Blood Bank Management System by CDAC
Blood Bank Management System by CDACBlood Bank Management System by CDAC
Blood Bank Management System by CDAC
 
Hospital Management System SRS
Hospital Management System SRSHospital Management System SRS
Hospital Management System SRS
 
Activity diagram for ticket vending machine
Activity diagram for ticket vending machineActivity diagram for ticket vending machine
Activity diagram for ticket vending machine
 
Online Tours and travel
Online Tours and travelOnline Tours and travel
Online Tours and travel
 
Project report on (atm MAnagment system)
Project report on (atm MAnagment system)Project report on (atm MAnagment system)
Project report on (atm MAnagment system)
 
Online Bus Reservation
Online Bus ReservationOnline Bus Reservation
Online Bus Reservation
 

Similar to BLOOD DONATION SYSTEM IN C++

STUDENT REPORT CARD GENERATE SYSTEM
STUDENT REPORT CARD GENERATE SYSTEMSTUDENT REPORT CARD GENERATE SYSTEM
STUDENT REPORT CARD GENERATE SYSTEM
vikram mahendra
 
Electricitybillsystemreport
ElectricitybillsystemreportElectricitybillsystemreport
Electricitybillsystemreport
vikram mahendra
 
BOOK SHOP SYSTEM C++
BOOK SHOP SYSTEM C++BOOK SHOP SYSTEM C++
BOOK SHOP SYSTEM C++
vikram mahendra
 
SUPER MARKET COMPUTER SYSTEM IN C++
SUPER MARKET COMPUTER SYSTEM IN C++SUPER MARKET COMPUTER SYSTEM IN C++
SUPER MARKET COMPUTER SYSTEM IN C++
vikram mahendra
 
Hospitalmanagement
HospitalmanagementHospitalmanagement
Hospitalmanagement
vikram mahendra
 
CANTEEN MANAGEMENT SYSTEM IN PYTHON
CANTEEN MANAGEMENT SYSTEM IN PYTHONCANTEEN MANAGEMENT SYSTEM IN PYTHON
CANTEEN MANAGEMENT SYSTEM IN PYTHON
vikram mahendra
 
Ip
IpIp
Blood pressure.pdf
Blood pressure.pdfBlood pressure.pdf
Blood pressure.pdf
SKma4
 
SALARY MANAGEMENT SYSTEM IN C++
SALARY MANAGEMENT SYSTEM IN C++SALARY MANAGEMENT SYSTEM IN C++
SALARY MANAGEMENT SYSTEM IN C++
vikram mahendra
 
Computer Science class 12
Computer Science  class 12Computer Science  class 12
Computer Science class 12
Abhishek Sinha
 
project report on Gas booking system in c++
project report on Gas booking system in c++ project report on Gas booking system in c++
project report on Gas booking system in c++
vikram mahendra
 
Design various classes and write a program to computerize the billing.pdf
Design various classes and write a program to computerize the billing.pdfDesign various classes and write a program to computerize the billing.pdf
Design various classes and write a program to computerize the billing.pdf
sktambifortune
 
Hospital management project_BY RITIKA SAHU.
Hospital management project_BY RITIKA SAHU.Hospital management project_BY RITIKA SAHU.
Hospital management project_BY RITIKA SAHU.
Ritika sahu
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
vikram mahendra
 
CANTEEN MANAGEMENT SYSTEM IN C++
CANTEEN MANAGEMENT SYSTEM IN C++CANTEEN MANAGEMENT SYSTEM IN C++
CANTEEN MANAGEMENT SYSTEM IN C++
vikram mahendra
 
1) According to Cudd and Jones, the term sexism refers to which .docx
1) According to Cudd and Jones, the term sexism refers to which .docx1) According to Cudd and Jones, the term sexism refers to which .docx
1) According to Cudd and Jones, the term sexism refers to which .docx
dorishigh
 
Durgesh
DurgeshDurgesh
Durgesh
dkbossverma
 
Library Management Project (computer science) class 12
Library Management Project (computer science) class 12Library Management Project (computer science) class 12
Library Management Project (computer science) class 12
RithuJ
 
@author Jane Programmer @cwid 123 45 678 @class
   @author Jane Programmer  @cwid   123 45 678  @class   @author Jane Programmer  @cwid   123 45 678  @class
@author Jane Programmer @cwid 123 45 678 @class
troutmanboris
 
[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary
[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary	[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary
[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary
EnlightenmentProject
 

Similar to BLOOD DONATION SYSTEM IN C++ (20)

STUDENT REPORT CARD GENERATE SYSTEM
STUDENT REPORT CARD GENERATE SYSTEMSTUDENT REPORT CARD GENERATE SYSTEM
STUDENT REPORT CARD GENERATE SYSTEM
 
Electricitybillsystemreport
ElectricitybillsystemreportElectricitybillsystemreport
Electricitybillsystemreport
 
BOOK SHOP SYSTEM C++
BOOK SHOP SYSTEM C++BOOK SHOP SYSTEM C++
BOOK SHOP SYSTEM C++
 
SUPER MARKET COMPUTER SYSTEM IN C++
SUPER MARKET COMPUTER SYSTEM IN C++SUPER MARKET COMPUTER SYSTEM IN C++
SUPER MARKET COMPUTER SYSTEM IN C++
 
Hospitalmanagement
HospitalmanagementHospitalmanagement
Hospitalmanagement
 
CANTEEN MANAGEMENT SYSTEM IN PYTHON
CANTEEN MANAGEMENT SYSTEM IN PYTHONCANTEEN MANAGEMENT SYSTEM IN PYTHON
CANTEEN MANAGEMENT SYSTEM IN PYTHON
 
Ip
IpIp
Ip
 
Blood pressure.pdf
Blood pressure.pdfBlood pressure.pdf
Blood pressure.pdf
 
SALARY MANAGEMENT SYSTEM IN C++
SALARY MANAGEMENT SYSTEM IN C++SALARY MANAGEMENT SYSTEM IN C++
SALARY MANAGEMENT SYSTEM IN C++
 
Computer Science class 12
Computer Science  class 12Computer Science  class 12
Computer Science class 12
 
project report on Gas booking system in c++
project report on Gas booking system in c++ project report on Gas booking system in c++
project report on Gas booking system in c++
 
Design various classes and write a program to computerize the billing.pdf
Design various classes and write a program to computerize the billing.pdfDesign various classes and write a program to computerize the billing.pdf
Design various classes and write a program to computerize the billing.pdf
 
Hospital management project_BY RITIKA SAHU.
Hospital management project_BY RITIKA SAHU.Hospital management project_BY RITIKA SAHU.
Hospital management project_BY RITIKA SAHU.
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
 
CANTEEN MANAGEMENT SYSTEM IN C++
CANTEEN MANAGEMENT SYSTEM IN C++CANTEEN MANAGEMENT SYSTEM IN C++
CANTEEN MANAGEMENT SYSTEM IN C++
 
1) According to Cudd and Jones, the term sexism refers to which .docx
1) According to Cudd and Jones, the term sexism refers to which .docx1) According to Cudd and Jones, the term sexism refers to which .docx
1) According to Cudd and Jones, the term sexism refers to which .docx
 
Durgesh
DurgeshDurgesh
Durgesh
 
Library Management Project (computer science) class 12
Library Management Project (computer science) class 12Library Management Project (computer science) class 12
Library Management Project (computer science) class 12
 
@author Jane Programmer @cwid 123 45 678 @class
   @author Jane Programmer  @cwid   123 45 678  @class   @author Jane Programmer  @cwid   123 45 678  @class
@author Jane Programmer @cwid 123 45 678 @class
 
[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary
[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary	[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary
[E-Dev-Day 2014][5/16] C++ and JavaScript bindings for EFL and Elementary
 

More from vikram mahendra

Communication skill
Communication skillCommunication skill
Communication skill
vikram mahendra
 
Python Project on Computer Shop
Python Project on Computer ShopPython Project on Computer Shop
Python Project on Computer Shop
vikram mahendra
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
vikram mahendra
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
vikram mahendra
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHONFLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
vikram mahendra
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
vikram mahendra
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
vikram mahendra
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
vikram mahendra
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
vikram mahendra
 
DATA TYPE IN PYTHON
DATA TYPE IN PYTHONDATA TYPE IN PYTHON
DATA TYPE IN PYTHON
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
vikram mahendra
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
vikram mahendra
 
INTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHONINTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHON
vikram mahendra
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
vikram mahendra
 
GREEN SKILL[PART-2]
GREEN SKILL[PART-2]GREEN SKILL[PART-2]
GREEN SKILL[PART-2]
vikram mahendra
 
GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]
vikram mahendra
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
vikram mahendra
 
Entrepreneurial skills
Entrepreneurial skillsEntrepreneurial skills
Entrepreneurial skills
vikram mahendra
 

More from vikram mahendra (20)

Communication skill
Communication skillCommunication skill
Communication skill
 
Python Project on Computer Shop
Python Project on Computer ShopPython Project on Computer Shop
Python Project on Computer Shop
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHONFLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHON
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
 
DATA TYPE IN PYTHON
DATA TYPE IN PYTHONDATA TYPE IN PYTHON
DATA TYPE IN PYTHON
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
 
INTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHONINTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHON
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
GREEN SKILL[PART-2]
GREEN SKILL[PART-2]GREEN SKILL[PART-2]
GREEN SKILL[PART-2]
 
GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
 
Entrepreneurial skills
Entrepreneurial skillsEntrepreneurial skills
Entrepreneurial skills
 

Recently uploaded

INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
ShwetaGawande8
 
Diversity Quiz Prelims by Quiz Club, IIT Kanpur
Diversity Quiz Prelims by Quiz Club, IIT KanpurDiversity Quiz Prelims by Quiz Club, IIT Kanpur
Diversity Quiz Prelims by Quiz Club, IIT Kanpur
Quiz Club IIT Kanpur
 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
Sarojini38
 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Catherine Dela Cruz
 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
khabri85
 
How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
Celine George
 
IoT (Internet of Things) introduction Notes.pdf
IoT (Internet of Things) introduction Notes.pdfIoT (Internet of Things) introduction Notes.pdf
IoT (Internet of Things) introduction Notes.pdf
roshanranjit222
 
Non-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech ProfessionalsNon-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech Professionals
MattVassar1
 
Decolonizing Universal Design for Learning
Decolonizing Universal Design for LearningDecolonizing Universal Design for Learning
Decolonizing Universal Design for Learning
Frederic Fovet
 
220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx
Kalna College
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
Kalna College
 
The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
heathfieldcps1
 
Creation or Update of a Mandatory Field is Not Set in Odoo 17
Creation or Update of a Mandatory Field is Not Set in Odoo 17Creation or Update of a Mandatory Field is Not Set in Odoo 17
Creation or Update of a Mandatory Field is Not Set in Odoo 17
Celine George
 
Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
PJ Caposey
 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
Friends of African Village Libraries
 
How to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRMHow to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRM
Celine George
 
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
Kalna College
 
Interprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdfInterprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdf
Ben Aldrich
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
TechSoup
 
The Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptxThe Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptx
PriyaKumari928991
 

Recently uploaded (20)

INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
 
Diversity Quiz Prelims by Quiz Club, IIT Kanpur
Diversity Quiz Prelims by Quiz Club, IIT KanpurDiversity Quiz Prelims by Quiz Club, IIT Kanpur
Diversity Quiz Prelims by Quiz Club, IIT Kanpur
 
bryophytes.pptx bsc botany honours second semester
bryophytes.pptx bsc botany honours  second semesterbryophytes.pptx bsc botany honours  second semester
bryophytes.pptx bsc botany honours second semester
 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
 
Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024Brand Guideline of Bashundhara A4 Paper - 2024
Brand Guideline of Bashundhara A4 Paper - 2024
 
How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
 
IoT (Internet of Things) introduction Notes.pdf
IoT (Internet of Things) introduction Notes.pdfIoT (Internet of Things) introduction Notes.pdf
IoT (Internet of Things) introduction Notes.pdf
 
Non-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech ProfessionalsNon-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech Professionals
 
Decolonizing Universal Design for Learning
Decolonizing Universal Design for LearningDecolonizing Universal Design for Learning
Decolonizing Universal Design for Learning
 
220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx220711130088 Sumi Basak Virtual University EPC 3.pptx
220711130088 Sumi Basak Virtual University EPC 3.pptx
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
 
The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
 
Creation or Update of a Mandatory Field is Not Set in Odoo 17
Creation or Update of a Mandatory Field is Not Set in Odoo 17Creation or Update of a Mandatory Field is Not Set in Odoo 17
Creation or Update of a Mandatory Field is Not Set in Odoo 17
 
Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
 
How to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRMHow to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRM
 
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...220711130095 Tanu Pandey message currency, communication speed & control EPC ...
220711130095 Tanu Pandey message currency, communication speed & control EPC ...
 
Interprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdfInterprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdf
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
 
The Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptxThe Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptx
 

BLOOD DONATION SYSTEM IN C++

  • 2. ACKNOWLEDGEMENT I would like to convey my heartful thanks to ……………………… (Computer Science) who always gave valuable suggestions & guidance for completion of my project. He helped me to understand & remember important details of the project. My project has been a success only because of his guidance. I am especially indented & I am also beholden to my friends. And finally I thank to the members of my family for their support & encouragement.
  • 3. CERTIFICATE This is to certify that ……………………….. of ……… of ………………………………………………… ……. has completed his project under my supervision. He has taken proper care & shown sincerity in completion of this project. I certify that this project is up to my expectation & as per the guideline issued by CBSE. …………………………….. (Computer Science faculty )
  • 4. Content 1. Introduction 2. Source Code 3. Output 4. Requirement 5. Advantages and disadvantages 6. Conclusion 7. System design
  • 5. This project BLOOD DONATION SYSTEM includes some facilities for the patients to search and get the required blood from the blood bank and if there is no blood available for the patients the blood bank provide the other group blood that is compatible for the patients and the patient can also search the donors according to their blood group and can directly contact to the donors also on the basis of city or blood group. This software keep the records of all the donors and their information about how many time they donated the blood to the blood bank with the dates of donation of blood. The blood bank keeps the records of the patient to whom the blood is given for the future records if needed by the management.
  • 6. //*************************************************************** // HEADER FILE USED IN PROJECT //**************************************************************** #include<stdio.h> #include<conio.h> #include<stdio.h> #include<process.h> #include<fstream.h> #include<iomanip.h> #include<string.h> #include<ctype.h> struct otherinfo { char mobno[15]; char email[70]; char bloodgroup[5]; char status; }; //name structure struct nameinfo { char fname[20]; char lname[20]; int age; }; // address structure struct address { int hno; char city[35]; char state[15]; }; //date structure struct dateinfo { int dd; int mm; int yy; }; struct donardate { char donarreg[25]; dateinfo dt; }; //******************FUNCTION PROTOTYPE**************** void intromain(); int getdonarno(); int checkpass();
  • 7. void intro(); void donar_new_old(); void admin_menu(); void donar_menu(); char *getreg(); char *getpatno(); void donar_report_menu(); void display_bloodstock(); void write_donars(); void patients_menu(); void write_donar_ALREDYREG(char rgno[15]); void displaydonarwithlist(char rgno[15]); void displaybloodgroupwise(char bgp[5]); void searchdonarcitywise(char city[15]); void display_bloodavailable(char blgrp[5]); int display_bloodavailable2(char blgrp[5]); void modify_donarinfo(char regno[5]); void patients_menu(char brg[5]); void write_bloodstock(char bldgr[5]); void decrease_bloodstock(char bldgr[5]); void patients_menu(char brg[5]); void displaypatientdetails(dateinfo bgp); void delete_donarinfo(char regno[5]); //******************FUNCTION PROTOTYPE**************** //****************CREATE FUNTION TO DISPLAY LIST OF DONARS BLOOD DONATION void donarlist(int c,donardate donardt,int y,int no) { //gotoxy(5,13); //cout<<"-S.NO.-DONATION DATES-||-S.NO.-DONATION DATES-||-S.NO.-DONATION DATES-"; int xx[3]={2,26,50}; gotoxy(xx[y],c); cout<<"||-"<<no<<". - "<<donardt.dt.dd<<"/"<<donardt.dt.mm<<"/"<<donardt.dt.yy<<"||"; } //blood stock class struct storeblood { char blno[10]; char bloodgroup[5]; int qty; }; //FILE NAME bloodstock.dat void stockbloodonetime() { storeblood stockbl[8]={{"BL01","A+",1},{"BL02","A-",1},{"BL03","B+",1},{"BL04","B-",1},{"BL05","AB+",1},{"BL06","AB-",1}, {"BL07","O+",1},{"BL08","O-",1}}; ifstream objiff("bloodstock.dat",ios::binary); storeblood st; if(!objiff) { gotoxy(10,20); cout<<"File could not be open !! Press any Key..."; getch(); ofstream objoff("bloodstock.dat",ios::binary); clrscr(); intromain(); for(int x=0;x<8;x++) { st=stockbl[x]; objoff.write((char*)&st,sizeof(storeblood)); } objoff.close(); } clrscr();
  • 8. intromain(); gotoxy(5,7); cout<<"----------------The Blood Group System-------------------------"; gotoxy(2,8); cout<<"There are four major blood groups determined by the presence or"; gotoxy(2,9); cout<<"absence of two antigens – A and B – on the surface of red blood cells:"; gotoxy(2,11); cout<<"Group A – has only the A antigen on red cells (and B antibody in the plasma)"; gotoxy(2,13); cout<<"Group B – has only the B antigen on red cells (and A antibody in the plasma)"; gotoxy(2,15); cout<<"Group AB – has both A and B antigens on red cells (but neither A nor B antibody in the plasma)"; gotoxy(2,18); cout<<"Group O – has neither A nor B antigens on red cells (but both A and B antibody are in the plasma)"; gotoxy(5,20); cout<<"================================================================"; objiff.close(); } //***************donar's class********************************** class donar { int dono; char donar_regist[15]; nameinfo nm; address add; dateinfo date1; otherinfo other; public: donar() { dono=0; }; //*********set all the variables void setfullname(nameinfo n) { strcpy(nm.fname,n.fname); strcpy(nm.lname,n.lname); } void setage(int ag) { nm.age=ag; } void setaddress(address ad1) { add.hno=ad1.hno; strcpy(add.city,ad1.city); strcpy(add.state,ad1.state); } void setmobileno(char mb[15]) { strcpy(other.mobno,mb); } void setemail(char eid[75]) { strcpy(other.email,eid); } void setblodgrp(char bg[5]) { strcpy(other.bloodgroup,bg); } //*********set all the variables char *getdonarreg()
  • 9. { return donar_regist; } dateinfo getdate() { return date1; } char *getbloodname() { return other.bloodgroup; } //input fuction for donar information void create_donar(int dn1) { gotoxy(5,7); cout<<"======================================================================"; gotoxy(1,8); cout<<"DONAR NO:"; dono=dn1; gotoxy(10,8); cout<<dono; gotoxy(20,8); cout<<"DONAR/'S REGISTRATION:"; gotoxy(48,8); cin>>donar_regist; gotoxy(20,9); cout<<"FIRST NAME:"; gotoxy(32,9); cin>>nm.fname; gotoxy(48,9); cout<<"LAST NAME:"; gotoxy(60,9); cin>>nm.lname; gotoxy(10,10); cout<<"AGE:"; gotoxy(20,10); cin>>nm.age; gotoxy(10,11); cout<<"-----------------DONAR'S ADDRESS DETAIL'S---------------------"; gotoxy(1,13); cout<<"HOUSE NO:"; gotoxy(12,13); cin>>add.hno; gotoxy(18,13); cout<<"city:"; gotoxy(30,13); cin>>add.city; gotoxy(55,13); cout<<"STATE:"; gotoxy(65,13); cin>>add.state; gotoxy(10,15); cout<<"-----------------DATE OF BLOOD DONATION----------------------"; gotoxy(10,16); cout<<"DATE(dd/mm/yyyy):"; gotoxy(30,16); cin>>date1.dd; gotoxy(35,16); cout<<"/"; gotoxy(40,16); cin>>date1.mm; gotoxy(45,16); cout<<"/"; gotoxy(50,16); cin>>date1.yy; gotoxy(10,18); cout<<"-----------------OTHER INFORMATION----------------------"; gotoxy(1,19); cout<<"MOBILE NO:";
  • 10. gotoxy(15,19); cin>>other.mobno; gotoxy(1,20); cout<<"E-MAIL(IF NO ENTER "NO"):"; gotoxy(30,20); cin>>other.email; if(strcmp(other.email,"NO")==0||strcmp(other.email,"no")==0) strcpy(other.email,"NO EMAIL ID"); gotoxy(1,21); cout<<"BLOOD GROUP(A+ , A- , B+ , B- , O+ , O- , AB+ , AB- ):"; gotoxy(5,22); cin>>other.bloodgroup; other.status='Y'; } //input fuction for donar information //****************display donars information in a box void display_donar_rectangle() { gotoxy(5,7); cout<<"======================================================================"; gotoxy(1,8); cout<<"DONAR REG:"; gotoxy(12,8); cout<<donar_regist; gotoxy(25,8); cout<<"NAME:"; gotoxy(30,8); cout<<" "<<nm.fname; gotoxy(40,8); cout<<"- "<<nm.lname; gotoxy(60,8); cout<<"AGE:"; gotoxy(65,8); cout<<nm.age; gotoxy(1,9); cout<<"ADDRESS::"; gotoxy(10,9); cout<<add.hno<<"-"; gotoxy(15,9); cout<<add.city; cout<<","<<add.state; gotoxy(1,10); cout<<"MOBILE NO:"; gotoxy(12,10); cout<<other.mobno; gotoxy(1,11); cout<<"E-MAIL:"; gotoxy(10,11); cout<<other.email; gotoxy(40,10); cout<<"BLOOD GROUP:"; gotoxy(60,10); cout<<other.bloodgroup; gotoxy(5,12); cout<<"======================================================================"; } //****************show all donars with blood groups row wise void showalldonarsrowwise(int c) { gotoxy(1,c); cout<<donar_regist<<setw(8)<<nm.fname<<"-"<<nm.lname<<setw(10)<<nm.age<<setw(5)<<add.hno<<"-"<<add.city<<","<<a dd.state<<setw(15)<<other.mobno<<setw(5)<<other.bloodgroup; gotoxy(1,c+1); cout<<"------------------------------------------------------------------------"; } //****************show all donars with blood groups row wise
  • 11. int getdono() { return dono; } char *getfname() { return nm.fname; } char *getgroup() { return other.bloodgroup; } char *getcity() { return add.city; } char getstatus() { return other.status; } }; //***************donar's class********************************** //************** //***************patient's class********************************** class patient { char pno[15]; nameinfo pnm; address padd; otherinfo pother; int no_of_bottle; dateinfo pdate1; public: //****************show all donars with blood groups row wise void showallpatientsrowwise(int c) { gotoxy(1,c); cout<<pno<<setw(8)<<pnm.fname<<"-"<<pnm.lname<<setw(10)<<pnm.age<<setw(5)<<padd.hno<<"-"<<padd.city<<","<<pad d.state<<setw(15)<<pother.mobno<<setw(5)<<pother.bloodgroup; gotoxy(1,c+1); cout<<"------------------------------------------------------------------------"; } //****************show all donars with blood groups row wise //input fuction for patients information void create_patient(char bloodgr[5]) { gotoxy(5,7); cout<<"====================PATIENT'S INFORMATION=============================="; gotoxy(1,8); cout<<"PAT.NO:"; gotoxy(10,8); cin>>pno; gotoxy(20,8); cout<<"FIRST NAME:"; gotoxy(32,8); cin>>pnm.fname; gotoxy(48,8); cout<<"LAST NAME:"; gotoxy(60,8); cin>>pnm.lname; gotoxy(10,9); cout<<"AGE:"; gotoxy(20,9); cin>>pnm.age; gotoxy(10,10); cout<<"-----------------PATIENT'S ADDRESS DETAIL'S---------------------";
  • 12. gotoxy(1,12); cout<<"HOUSE NO:"; gotoxy(12,12); cin>>padd.hno; gotoxy(18,12); cout<<"ADDRESS:"; gotoxy(30,12); cin>>padd.city; gotoxy(55,12); cout<<"STATE:"; gotoxy(65,12); cin>>padd.state; gotoxy(10,14); cout<<"-----------------DATE OF BLOOD GIVEN TO PATIENT--------------------"; gotoxy(10,15); cout<<"DATE(dd/mm/yyyy):"; gotoxy(30,15); cin>>pdate1.dd; gotoxy(35,15); cout<<"/"; gotoxy(40,15); cin>>pdate1.mm; gotoxy(45,15); cout<<"/"; gotoxy(50,15); cin>>pdate1.yy; gotoxy(10,17); cout<<"-----------------OTHER INFORMATION----------------------"; gotoxy(1,18); cout<<"MOBILE NO:"; gotoxy(15,18); cin>>pother.mobno; gotoxy(1,19); cout<<"E-MAIL(IF NO ENTER "NO"):"; gotoxy(30,19); cin.getline(pother.email,70); if(strcmp(pother.email,"NO")==0||strcmp(pother.email,"no")==0) strcpy(pother.email,"NO EMAIL ID"); gotoxy(1,20); no_of_bottle=1; strcpy(pother.bloodgroup,bloodgr);; pother.status='Y'; } //input fuction for patients information char *getpno() { return pno; } dateinfo getdate() { return pdate1; } int pdd() { return pdate1.dd; } int pmm() { return pdate1.mm; } int pyy() { return pdate1.yy; } char getstatus() { return pother.status;
  • 13. } }; //***************patient's class********************************** //***************blood storage class********************************** class bloodstore { int blstno; char bloodgroup[5]; int qty; char status; public: void add_bloodstore(int blno,char blgr[5],int qtty) { blstno=blno; strcpy(bloodgroup,blgr); qty=qtty; status='Y'; } void setbloodqty() { qty=qty+1; } int getblstno() { return blstno; } int getqty() { return qty; } char getstatus() { return status; } char *getbloodgroup() { return bloodgroup; } }; //***************blood storage class********************************** //*************************************************************** // THE MAIN FUNCTION OF PROGRAM //**************************************************************** void main() { char ch; intro(); if(checkpass()==0) { do { //****************TEMPORARY*********************** clrscr(); intromain(); gotoxy(20,6); cout<<"=================MAIN MENU===================="; gotoxy(28,7); cout<<"01. BLOOD DONATION INFO./creating blood qty file"; gotoxy(28,8); cout<<"02. ADMINISTRATOR"; gotoxy(28,9); cout<<"03. EXIT"; gotoxy(20,10); cout<<"=============================================="; gotoxy(25,12); cout<<"Please Select Your Option (1-3) "; gotoxy(30,14);
  • 14. ch=getche(); switch(ch) { case '1': clrscr(); stockbloodonetime(); getch(); break; case '2': admin_menu(); break; case '3':exit(0); default :cout<<"a"; } }while(ch!='3'); }else { exit(0); } } //*************************************************************** // THE MAIN FUNCTION OF PROGRAM //**************************************************************** //***************main intro void intromain() { clrscr(); gotoxy(1,2); cout<<"*************************BLOOD******DONATION********SYSTEM********************"; gotoxy(1,3); cout<<"******************************************************************************"; } //***************main intro //******************************login name and password**************** int checkpass() { char nm[20]; char pass[10]; clrscr(); intromain(); gotoxy(20,20); cout<<"PLEASE ENTER THE USER NAME:"; gotoxy(20,21); cin>>nm; clrscr(); gotoxy(20,20); cout<<"PLEASE ENTER THE PASSWORD:"; gotoxy(20,21); cin>>pass; if(strcmp(nm,"admin")==0 && strcmp(pass,"vicky")==0) { return 0; }else { return 1; } } //******************************************************************** //*************************************************************** // INTRODUCTION FUNCTION //**************************************************************** void intro() { clrscr(); gotoxy(4,2); cout<<"****************************BLOOD DONATION******************************"; gotoxy(12,4); cout<<"==========================================================="; gotoxy(5,5); cout<<"****************************S=Y=S=T=E=M********************************";
  • 15. gotoxy(50,10); cout<<"PROJECT:"; gotoxy(50,12); cout<<"MADE BY : --------------------"; gotoxy(10,14); cout<<"---------------CLASS : XII A--------------------"; getch(); } //*************************************************************** // ADMINSTRATOR MENU FUNCTION //**************************************************************** void admin_menu() { clrscr(); char ch2; //int num; //************************************************************ clrscr(); intromain(); gotoxy(20,6); cout<<"=================ADMIN MENU===================="; gotoxy(22,7); cout<<"1.DONAR INFORMATION"; gotoxy(22,8); cout<<"2.BLOOD TO PATIENTS INFORMATION"; gotoxy(22,9); cout<<"3.REPORTS"; gotoxy(22,10); cout<<"4.BACK TO MAIN MENU"; gotoxy(22,11); cout<<"Please Enter Your Choice (1-4) "; gotoxy(22,12); //********************************************************** ch2=getche(); switch(ch2) { case '1': donar_menu(); break; case '2': //*****************search for blood char bldgroup[15]; clrscr(); intromain(); gotoxy(10,8); cout<<"*****ENTER THE BLOOD GROUP(QTY) TO BE SEARCHED(WITH COMPATIBILITY):"; gotoxy(55,9); cin>>bldgroup; //display_bloodavailable(bldgroup); if(display_bloodavailable2(bldgroup)==0) { patients_menu(bldgroup); }else { gotoxy(5,18); cout<<"SORRY BLOOD NOT IN STOCK"; } break; case '3': donar_report_menu(); break; default: cout<<"a";//admin_menu(); } } //*************************************************************** // DONARS INFORMATION ADD / MODIFY / DELETE
  • 16. //**************************************************************** void donar_menu() { clrscr(); char ch2; char regno[5]; //************************************************************ clrscr(); intromain(); gotoxy(20,6); cout<<"=================DONAR'S MENU===================="; gotoxy(22,7); cout<<"1.ADD DONAR INFORMATION"; gotoxy(22,8); cout<<"2.MODIFY DONAR INFORMATION"; gotoxy(22,9); cout<<"3.DELETE DONAR INFORMATION"; gotoxy(22,10); cout<<"4.BACK TO MAIN MENU"; gotoxy(22,11); cout<<"Please Enter Your Choice (1-4) "; gotoxy(22,12); //********************************************************** ch2=getche(); switch(ch2) { case '1': clrscr(); donar_new_old(); break; case '2': clrscr(); intromain(); gotoxy(10,8); cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED:"; gotoxy(55,9); cin>>regno; modify_donarinfo(regno); break; case '3': clrscr(); intromain(); gotoxy(10,8); cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED AND DELETE:"; gotoxy(55,9); cin>>regno; delete_donarinfo(regno); break; default: cout<<"a";//admin_menu(); } } //*************************************************************** //*************donars registration or already registered void donar_new_old() { clrscr(); char ch2; //int num; char regno[15]; //************************************************************ clrscr(); intromain(); gotoxy(20,6); cout<<"=================DONAR'S MENU===================="; gotoxy(22,7); cout<<"1.NEW DONAR REGISTRATION"; gotoxy(22,8);
  • 17. cout<<"2.ALREADY REGISTERED"; gotoxy(22,9); cout<<"3.BACK TO MAIN MENU"; gotoxy(22,10); cout<<"Please Enter Your Choice (1-4) "; gotoxy(22,11); //********************************************************** ch2=getche(); switch(ch2) { case '1': clrscr(); write_donars(); break; case '2': clrscr(); intromain(); gotoxy(20,6); cout<<"=================ALREADY REGISTERED===================="; gotoxy(5,7); cout<<"ENTER THE DONARS REGISTERED NO:"; gotoxy(40,7); cin>>regno; write_donar_ALREDYREG(regno); break; default: cout<<"a";//admin_menu(); } } //*************donars registration or already registered //*************************************************************** // donar's reports //**************************************************************** void donar_report_menu() { clrscr(); char ch2; char regno[15]; char bldgroup[5],cty[35]; dateinfo dtvalue2; //************************************************************ clrscr(); intromain(); gotoxy(20,6); cout<<"=================REPORTS===================="; gotoxy(22,7); cout<<"1.ALL DONAR INFORMATION BLOOD GROUP WISE"; gotoxy(22,8); cout<<"2.ALL DONAR INFORMATION CITY WISE"; gotoxy(22,9); cout<<"3.ALL BLOOD GROUP WITH AVAILABILITY"; gotoxy(22,10); cout<<"4.DISPLAY DONAR INFORMATION WITH DATE OF DONATIONS"; gotoxy(22,11); cout<<"5.DISPLAY PATIENTS INFORMATION WITH BLOOD INFO. DATE WISE"; gotoxy(22,12); cout<<"6.DISPLAY BLOOD GROUP WITH QUANTITY"; gotoxy(22,13); cout<<"7.BACK TO MAIN MENU"; gotoxy(22,14); cout<<"Please Enter Your Choice (1-7) "; gotoxy(22,15); //********************************************************** ch2=getche(); switch(ch2) {
  • 18. case '1': clrscr(); intromain(); gotoxy(10,8); cout<<"*****ENTER THE BLOOD GROUP TO BE SEARCHED(WITH COMPATIBILITY):"; gotoxy(55,9); cin>>bldgroup; displaybloodgroupwise(bldgroup); break; case '2': clrscr(); intromain(); gotoxy(10,8); cout<<"*****ENTER THE CITY WISE SEARCH OF DONARS:"; gotoxy(55,9); cin>>cty; searchdonarcitywise(cty); break; case '6': clrscr(); intromain(); gotoxy(10,8); cout<<"*****ENTER THE BLOOD GROUP(QTY) TO BE SEARCHED(WITH COMPATIBILITY):"; gotoxy(55,9); cin>>bldgroup; display_bloodavailable(bldgroup); break; case '4': clrscr(); intromain(); gotoxy(10,8); cout<<"*****ENTER THE REG. NO. OF DONAR TO BE SEARCHED:"; gotoxy(55,9); cin>>regno; displaydonarwithlist(regno); break; case '5': clrscr(); intromain(); gotoxy(10,8); cout<<"*****ENTER THE DATE OF BLOOD GIVEN TO PATIENTS:"; gotoxy(10,10); cout<<"DATE(dd/mm/yyyy):"; gotoxy(30,10); cin>>dtvalue2.dd; gotoxy(35,10); cout<<"/"; gotoxy(40,10); cin>>dtvalue2.mm; gotoxy(45,10); cout<<"/"; gotoxy(50,10); cin>>dtvalue2.yy; displaypatientdetails(dtvalue2); break; case '3': display_bloodstock(); default: cout<<"a";//admin_menu(); } } //*****************add new registered donars information void write_donars() { ofstream objoff; donar donarobj; donardate donalist;
  • 19. objoff.open("donars.dat",ios::binary|ios::app); ofstream objofflist("donarlist.dat",ios::binary|ios::app); clrscr(); intromain(); int rnn=getdonarno(); char getprv_regno[15]; strcpy(getprv_regno,getreg()); if(strcmp(getprv_regno,"NULL")!=0) { gotoxy(5,4); cout<<"Previous REGNO: "<<getprv_regno; } if(rnn>10000) { rnn=1; } donarobj.create_donar(rnn); objoff.write((char*)&donarobj,sizeof(donarobj)); //************write to donar list also strcpy(donalist.donarreg,donarobj.getdonarreg()); donalist.dt=donarobj.getdate(); objofflist.write((char*)&donalist,sizeof(donalist)); objoff.close(); objofflist.close(); gotoxy(10,24); cout<<"***************DONARS RECORD SAVED******************* "; //********send the blood group to the bloodstock file write_bloodstock(donarobj.getbloodname()); //************************************************ cin.ignore(); getch(); } //*****************add new registered donars information //************get thje donars last number**************** char *getreg() { ifstream objiff; donar st; int count=0; char tmpregno[15]; objiff.open("donars.dat",ios::binary); objiff.seekg(0,ios::beg); if(!objiff) { cout<<"File could not be open !! Press any Key..."; getch(); } //**************temporary hiding these lines while(objiff.read((char *) &st, sizeof(donar))) { count++; } //***********jump to the last line objiff.seekg(count-sizeof(st),ios::beg); objiff.read((char *) &st, sizeof(donar)); strcpy(tmpregno,st.getdonarreg()); objiff.close(); if(count!=0) return tmpregno; else return "NULL"; } //************get thje donars last number**************** //******************all the donars fuction details**************************** //******************generate the number
  • 20. int getdonarno() { ifstream objiff; donar st; int count=0; objiff.open("donars.dat",ios::binary); objiff.seekg(0,ios::beg); if(!objiff) { cout<<"File could not be open !! Press any Key..."; getch(); } //**************temporary hiding these lines while(objiff.read((char *) &st, sizeof(donar))) { count++; } //***********jump to the last line objiff.seekg(count-sizeof(st),ios::beg); objiff.read((char *) &st, sizeof(donar)); count=st.getdono(); count++; objiff.close(); return count; } //****************generate the donars number //**************write the donars dates who is already registered void write_donar_ALREDYREG(char rgno[15]) { /* struct donardate { char donarreg[25]; dateinfo dt; }; */ dateinfo date1; donar dr; int flag=0; donardate donalist; ifstream fp; fp.open("donars.dat",ios::binary); ofstream objoff("donarlist.dat",ios::binary|ios::app); if(!fp) { cout<<"File could not be open !! Press any Key..."; getch(); return; } while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getdonarreg(),rgno)==0) { clrscr(); intromain(); dr.display_donar_rectangle(); flag=1; strcpy(donalist.donarreg,dr.getdonarreg()); } } fp.close(); if(flag==0) {cout<<"nnrecord not exist"; getch(); }else { gotoxy(5,14); cout<<"ENTER THE DATE OF BLOOD DOATION:"; gotoxy(10,16);
  • 21. cout<<"DATE(dd/mm/yyyy):"; gotoxy(30,16); cin>>date1.dd; gotoxy(35,16); cout<<"/"; gotoxy(40,16); cin>>date1.mm; gotoxy(45,16); cout<<"/"; gotoxy(50,16); cin>>date1.yy; donalist.dt.dd=date1.dd; donalist.dt.mm=date1.mm; donalist.dt.yy=date1.yy; objoff.write((char*)&donalist,sizeof(donalist)); objoff.close(); //********send the blood group to the bloodstock file write_bloodstock(dr.getbloodname()); //************************************************ } } //**************write the donars dates who is already registered //**********donar name and list of blood donation void displaydonarwithlist(char rgno[15]) { ifstream fp; fp.open("donars.dat",ios::binary); ifstream objiff("donarlist.dat",ios::binary); donardate donalist; donar dr; int flag=-1; if(!fp) { cout<<"File could not be open !! Press any Key..."; getch(); return; } while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getdonarreg(),rgno)==0) { clrscr(); intromain(); dr.display_donar_rectangle(); flag=1; strcpy(donalist.donarreg,dr.getdonarreg()); } } fp.close(); if(flag==1) { gotoxy(5,13); cout<<"-------------------LIST OF BLOOD DONATED BY DONAR---------------------"; int c1=14; int no1=1; int y1=0; while(objiff.read((char*)&donalist,sizeof(donardate))) { if(strcmp(rgno,donalist.donarreg)==0) { if(y1<=2) { donarlist(c1,donalist,y1,no1); y1++; no1++; }else
  • 22. { y1=0; c1++; no1++; } } } } objiff.close(); getch(); } //**********donar name and list of blood donation //************blood stock list void display_bloodstock() { ifstream objiff("bloodstock.dat",ios::binary); storeblood blstk; if(!objiff) { cout<<"File could not be open !! Press any Key..."; getch(); return; } clrscr(); intromain(); int c1=5; gotoxy(5,c1); c1++; cout<<"BLOODNO"<<setw(18)<<"BLOOD GROUP"<< setw(20)<<"QUANTITY"; while(objiff.read((char*)&blstk,sizeof(blstk))) { gotoxy(5,c1); cout<<blstk.blno<<setw(18)<<blstk.bloodgroup<<setw(20)<<blstk.qty; c1++; } objiff.close(); getch(); } //************blood stock list //*******************display blood group wise with compatibility void displaybloodgroupwise(char bgp[5]) { ifstream fp; fp.open("donars.dat",ios::binary); donar dr; if(!fp) { cout<<"File could not be open !! Press any Key..."; getch(); return; } clrscr(); intromain(); int c1=7; gotoxy(1,5); cout<<"REG No."<<setw(15)<<"NAME OF DONAR"<<setw(5)<<"AGE"<<setw(12)<<"------ ADDRESS-------"<<setw(18)<<"MOBILE NO."<<setw(12)<<"BLOOD GROUP"; gotoxy(1,6); cout<<"========================================================================"; while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getbloodname(),bgp)==0)
  • 23. { dr.showalldonarsrowwise(c1); c1++; } } fp.close(); fp.open("donars.dat",ios::binary); gotoxy(1,c1); cout<<"========================================================================"; c1++; gotoxy(1,c1); cout<<"==========OTHER BLOOD COMPATIBLE BLOOD GROUPS==========================="; c1++; //-------for A+ if(strcmp(bgp,"A+")==0) { while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getbloodname(),"A-")==0 ||strcmp(dr.getbloodname(),"O-")==0 || strcmp(dr.getbloodname(),"O+")==0) { dr.showalldonarsrowwise(c1); c1++; } } } ///for A- else if(strcmp(bgp,"A-")==0 ) { while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getbloodname(),"O-")==0) { dr.showalldonarsrowwise(c1); c1++; } } } //for B+ else if(strcmp(bgp,"B+")==0) { while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getbloodname(),"B-")==0 ||strcmp(dr.getbloodname(),"O-")==0 || strcmp(dr.getbloodname(),"O+")==0) { dr.showalldonarsrowwise(c1); c1++; } } } //**for B- else if(strcmp(bgp,"B-")==0) { while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getbloodname(),"B-")==0 ||strcmp(dr.getbloodname(),"O-")==0) { dr.showalldonarsrowwise(c1); c1++; } } } //**for AB+ else if(strcmp(bgp,"AB+")==0)
  • 24. { while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getbloodname(),"A+")==0 || strcmp(dr.getbloodname(),"A-")==0 || strcmp(dr.getbloodname(),"B+")==0 || strcmp(dr.getbloodname(),"B-")==0 || strcmp(dr.getbloodname(),"O+")==0 || strcmp(dr.getbloodname(),"O-")==0 || strcmp(dr.getbloodname(),"AB-")==0) { dr.showalldonarsrowwise(c1); c1++; } } } //**for AB- else if(strcmp(bgp,"AB-")==0) { while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getbloodname(),"O-")==0 ||strcmp(dr.getbloodname(),"A-")==0 ||strcmp(dr.getbloodname(),"B-")==0 || strcmp(dr.getbloodname(),"AB-")==0) { dr.showalldonarsrowwise(c1); c1++; } } } //**for O+ else if(strcmp(bgp,"O+")==0) { while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getbloodname(),"O-")==0) { dr.showalldonarsrowwise(c1); c1++; } } } //**for O- else if(strcmp(bgp,"O-")==0) { gotoxy(5,c1); cout<<"*****************ONLY O - *************************"; } //**************************ends here************************ fp.close(); getch(); } //*******************display blood group wise with compatibility //***************donars information city wise void searchdonarcitywise(char city[15]) { ifstream fp; fp.open("donars.dat",ios::binary); donar dr; if(!fp) { cout<<"File could not be open !! Press any Key..."; getch(); return; } clrscr(); intromain(); int c1=7; gotoxy(1,5); cout<<"REG No."<<setw(15)<<"NAME OF DONAR"<<setw(5)<<"AGE"<<setw(12)<<"------
  • 25. ADDRESS-------"<<setw(18)<<"MOBILE NO."<<setw(12)<<"BLOOD GROUP"; gotoxy(1,6); cout<<"========================================================================"; while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getcity(),city)==0) { dr.showalldonarsrowwise(c1); c1++; } } fp.close(); getch(); } //***************donars information city wise //**************search and display the avaliblity of blood void display_bloodavailable(char blgrp[5]) { ifstream objiff("bloodstock.dat",ios::binary); storeblood blstk; if(!objiff) { cout<<"File could not be open !! Press any Key..."; getch(); return; } clrscr(); intromain(); int c1=5; gotoxy(5,c1); c1++; cout<<"BLOODNO"<<setw(18)<<"BLOOD GROUP"<< setw(20)<<"QUANTITY"; while(objiff.read((char*)&blstk,sizeof(blstk))) { if( strcmp(blstk.bloodgroup,blgrp)==0) { gotoxy(5,c1); cout<<blstk.blno<<setw(18)<<blstk.bloodgroup<<setw(20)<<blstk.qty; c1++; } } objiff.close(); //*******************main ends here ifstream fp; fp.open("bloodstock.dat",ios::binary); storeblood dr; gotoxy(1,c1); cout<<"========================================================================"; c1++; gotoxy(1,c1); cout<<"==========OTHER BLOOD COMPATIBLE BLOOD GROUPS==========================="; c1++; //-------for A+ if(strcmp(blgrp,"A+")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if(strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"O+")==0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; }
  • 26. } } ///for A- else if(strcmp(blgrp,"A-")==0 ) { while(fp.read((char*)&dr,sizeof(storeblood))) { if(strcmp(dr.bloodgroup,"O-")==0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; } } } //for B+ else if(strcmp(blgrp,"B+")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if(strcmp(dr.bloodgroup,"B-")==0 ||strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"O+")==0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; } } } //**for B- else if(strcmp(blgrp,"B-")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if(strcmp(dr.bloodgroup,"B-")==0 ||strcmp(dr.bloodgroup,"O-")==0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; } } } //**for AB+ else if(strcmp(blgrp,"AB+")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if(strcmp(dr.bloodgroup,"A+")==0 || strcmp(dr.bloodgroup,"A-")==0 || strcmp(dr.bloodgroup,"B+")==0 || strcmp(dr.bloodgroup,"B-")==0 || strcmp(dr.bloodgroup,"O+")==0 || strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"AB-")==0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; } } } //**for AB- else if(strcmp(blgrp,"AB-")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if(strcmp(dr.bloodgroup,"O-")==0 ||strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"B-")==0 ||
  • 27. strcmp(dr.bloodgroup,"AB-")==0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; } } } //**for O+ else if(strcmp(blgrp,"O+")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if(strcmp(dr.bloodgroup,"O-")==0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; } } } //**for O- else if(strcmp(blgrp,"O-")==0) { gotoxy(5,c1); cout<<"*****************ONLY O - *************************"; } //**************************ends here************************ fp.close(); getch(); //******************compatibility ends here } //**************search and display the avaliblity of blood //***************delete donars information void delete_donarinfo(char regno[5]) { clrscr(); intromain(); ifstream fp; donar dr; int flag=0; fp.open("donars.dat",ios::binary); if(!fp) { cout<<"File could not be open !! Press any Key..."; getch(); return; } while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getdonarreg(),regno)==0) { flag=1; //fpos=(int)fp.tellg(); break; } } char ch; if(flag==0) { cout<<"nnrecord not exist"; fp.close(); }else {
  • 28. // fp.seekp(fpos-sizeof(donar),ios::beg); dr.display_donar_rectangle(); fp.close(); //*******deletion of the records starts from here gotoxy(1,15); cout<<"*****************************************************************************"; gotoxy(5,16); cout<<"======DO YOU WANT TO DELETE THE RECORDS GIVEN ABOVE[YES(Y) OR NO (N)========"; gotoxy(2,17); cin>>ch; if (toupper(ch)=='Y') { ofstream outFile; outFile.open("Temp1.dat",ios::binary); ifstream objiff("donars.dat",ios::binary); objiff.seekg(0,ios::beg); while(objiff.read((char *) &dr, sizeof(donar))) { if(strcmp(dr.getdonarreg(),regno)!=0) { outFile.write((char *) &dr, sizeof(donar)); } } outFile.close(); objiff.close(); remove("donars.dat"); rename("Temp1.dat","donars.dat"); //againopenandclose(); gotoxy(30,20); cout<<"----------------------------Record Deleted----------------------------------"; getch(); } } //***********************delete record ends************************************ } //***************delete donars information //****************modification of donar information void modify_donarinfo(char regno[5]) { char ch2; clrscr(); intromain(); fstream fp; fp.open("donars.dat",ios::binary|ios::in|ios::out); //donardate donalist; donar dr; nameinfo nminfo; address ad1; char mb[15],eid[75],bg[5]; int fpos=-1,ag=0; int flag=-1,flagblood=-1; if(!fp) { cout<<"File could not be open !! Press any Key..."; getch(); return; } while(fp.read((char*)&dr,sizeof(donar))) { if(strcmp(dr.getdonarreg(),regno)==0)
  • 29. { //clrscr(); //intromain(); //dr.display_donar_rectangle(); flag=1; //strcpy(donalist.donarreg,dr.getdonarreg()); fpos=(int)fp.tellg(); break; } } // fp.close(); if(flag==1) { fp.seekp(fpos-sizeof(donar),ios::beg); dr.display_donar_rectangle(); //fp.write((char *) &dr, sizeof(donar)); //-------------------------------------------- gotoxy(20,13); cout<<"==========DONAR'S MODIFICATION MENU===================="; gotoxy(22,14); cout<<"1.MODIFY NAME"; gotoxy(22,15); cout<<"2.MODIFY AGE"; gotoxy(22,16); cout<<"3.MODIFY ADDRESS"; gotoxy(22,17); cout<<"4.MODIFY MOBILE NO."; gotoxy(22,18); cout<<"5.MODIFY EMAIL"; gotoxy(22,19); cout<<"6.MODIFY BLOOD GROUP"; //gotoxy(22,20); //cout<<"7.BACK TO MAIN MENU"; gotoxy(22,21); cout<<"Please Enter Your Choice (1-6) "; gotoxy(22,22); //********************************************************** ch2=getche(); clrscr(); intromain(); dr.display_donar_rectangle(); switch(ch2) { case '1': gotoxy(20,13); cout<<"===ENTER THE FIRST NAME TO MODIFY: ";cin>>nminfo.fname; gotoxy(20,14); cout<<"===ENTER THE LAST NAME TO MODIFY: ";cin>>nminfo.lname; dr.setfullname(nminfo); break; case '2': gotoxy(20,13); cout<<"===ENTER THE AGE TO MODIFY: ";cin>>ag; dr.setage(ag); break; case '3': gotoxy(20,13); cout<<"===ENTER THE HNO TO MODIFY: ";cin>>ad1.hno; gotoxy(20,14); cout<<"===ENTER THE CITY TO MODIFY: ";cin>>ad1.city; gotoxy(20,15); cout<<"===ENTER THE STATE TO MODIFY: ";cin>>ad1.state; dr.setaddress(ad1); break; case '4': gotoxy(20,13);
  • 30. cout<<"===ENTER THE MOBILE TO MODIFY: ";cin>>mb; dr.setmobileno(mb); break; case '5': gotoxy(20,13); cout<<"===ENTER THE EMAIL TO MODIFY: ";cin>>eid; dr.setemail(eid); break; case '6': gotoxy(20,13); cout<<"===ENTER THE BLOOD GROUP TO MODIFY: ";cin>>bg; dr.setblodgrp(bg); flagblood=1; break; default: cout<<"a";//admin_menu(); } fp.write((char *) &dr, sizeof(donar)); } fp.close(); gotoxy(10,24); if(flagblood==1) { gotoxy(20,15); cout<<"old blood:"<<dr.getbloodname()<<" new blood::"<<bg; write_bloodstock(bg); decrease_bloodstock(dr.getbloodname()); flagblood=-1; } cout<<"*****************modified the record******************"; getch(); } //****************increase the blood qty by 1 void write_bloodstock(char bldgr[5]) { int fpos=-1; fstream File; storeblood st,tmp; File.open("bloodstock.dat",ios::binary|ios::in|ios::out); if(!File) { cout<<"File could not be open !! Press any Key..."; getch(); return; } while(File) { File.read((char *) &st, sizeof(storeblood)); if(strcmp(st.bloodgroup,bldgr)==0) { fpos=(int)File.tellg(); break; } } File.seekp(fpos-sizeof(storeblood)); tmp=st; tmp.qty=tmp.qty+1; File.write((char *) &tmp, sizeof(storeblood)); File.close(); } //**************************************************************************** //****************decrease the blood stock by 1******************************
  • 31. //****************increase the blood qty by 1 void decrease_bloodstock(char bldgr[5]) { int fpos=-1; fstream File; storeblood st,tmp; File.open("bloodstock.dat",ios::binary|ios::in|ios::out); if(!File) { cout<<"File could not be open !! Press any Key..."; getch(); return; } while(File.read((char *) &st, sizeof(storeblood))) { if(strcmp(st.bloodgroup,bldgr)==0) { fpos=(int)File.tellg(); break; } } File.seekp(fpos-sizeof(storeblood),ios::beg); tmp=st; tmp.qty=tmp.qty-1; File.write((char *) &tmp, sizeof(storeblood)); File.close(); } //************************************************************************ //*************function to search for blood and compatibility and return true int display_bloodavailable2(char blgrp[5]) { int returnvalue=-1; ifstream objiff("bloodstock.dat",ios::binary); storeblood blstk; if(!objiff) { cout<<"File could not be open !! Press any Key..."; getch(); //return; } clrscr(); intromain(); int c1=5; gotoxy(5,c1); c1++; cout<<"BLOODNO"<<setw(18)<<"BLOOD GROUP"<< setw(20)<<"QUANTITY"; while(objiff.read((char*)&blstk,sizeof(blstk))) { if( strcmp(blstk.bloodgroup,blgrp)==0 && blstk.qty>0) { gotoxy(5,c1); cout<<blstk.blno<<setw(18)<<blstk.bloodgroup<<setw(20)<<blstk.qty; c1++; returnvalue=0; } } objiff.close(); //*******************main ends here ifstream fp; fp.open("bloodstock.dat",ios::binary); storeblood dr; gotoxy(1,c1); cout<<"========================================================================";
  • 32. c1++; gotoxy(1,c1); cout<<"==========OTHER BLOOD COMPATIBLE BLOOD GROUPS==========================="; c1++; //-------for A+ if(strcmp(blgrp,"A+")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if((strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"O+")==0) && dr.qty>0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; returnvalue=0; } } } ///for A- else if(strcmp(blgrp,"A-")==0 ) { while(fp.read((char*)&dr,sizeof(storeblood))) { if((strcmp(dr.bloodgroup,"O-")==0)&& dr.qty>0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; returnvalue=0; } } } //for B+ else if(strcmp(blgrp,"B+")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if((strcmp(dr.bloodgroup,"B-")==0 ||strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"O+")==0)&& dr.qty>0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; returnvalue=0; } } } //**for B- else if(strcmp(blgrp,"B-")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if((strcmp(dr.bloodgroup,"B-")==0 ||strcmp(dr.bloodgroup,"O-")==0)&& dr.qty>0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; returnvalue=0; } } } //**for AB+ else if(strcmp(blgrp,"AB+")==0) { while(fp.read((char*)&dr,sizeof(storeblood)))
  • 33. { if((strcmp(dr.bloodgroup,"A+")==0 || strcmp(dr.bloodgroup,"A-")==0 || strcmp(dr.bloodgroup,"B+")==0 || strcmp(dr.bloodgroup,"B-")==0 || strcmp(dr.bloodgroup,"O+")==0 || strcmp(dr.bloodgroup,"O-")==0 || strcmp(dr.bloodgroup,"AB-")==0)&& dr.qty>0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; returnvalue=0; } } } //**for AB- else if(strcmp(blgrp,"AB-")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if((strcmp(dr.bloodgroup,"O-")==0 ||strcmp(dr.bloodgroup,"A-")==0 ||strcmp(dr.bloodgroup,"B-")==0 || strcmp(dr.bloodgroup,"AB-")==0)&& dr.qty>0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; returnvalue=0; } } } //**for O+ else if(strcmp(blgrp,"O+")==0) { while(fp.read((char*)&dr,sizeof(storeblood))) { if((strcmp(dr.bloodgroup,"O-")==0)&& dr.qty>0) { gotoxy(5,c1); cout<<dr.blno<<setw(18)<<dr.bloodgroup<<setw(20)<<dr.qty; c1++; returnvalue=0; } } } //**for O- else if((strcmp(blgrp,"O-")==0)&& dr.qty>0) { gotoxy(5,c1); cout<<"*****************ONLY O - *************************"; returnvalue=0; } //**************************ends here************************ fp.close(); return returnvalue; //******************compatibility ends here } //*************function to search for blood and compatibility and return true //************function to display all patients details date wise void displaypatientdetails(dateinfo bgp) { ifstream fp; fp.open("patientsinfo.dat",ios::binary); patient dr; if(!fp) { cout<<"File could not be open !! Press any Key..."; getch(); return;
  • 34. } clrscr(); intromain(); //***********display date gotoxy(10,5); cout<<"DATE(dd/mm/yyyy): "<<bgp.dd<<"/"<<bgp.mm<<"/"<<bgp.yy; //********************** int c1=9; gotoxy(1,6); cout<<"REG No."<<setw(15)<<"NAME OF PATIENT"<<setw(5)<<"AGE"<<setw(12)<<"------ ADDRESS-------"<<setw(18)<<"MOBILE NO."<<setw(12)<<"BLOOD GROUP"; gotoxy(1,7); cout<<"========================================================================"; while(fp.read((char*)&dr,sizeof(patient))) { if(dr.pdd()==bgp.dd && dr.pmm()==bgp.mm && dr.pyy()==bgp.yy) { dr.showallpatientsrowwise(c1); c1++; } } fp.close(); getch(); } //************function to display all patients details date wise //*************************************************************** // patient's information //*************************************************************** void patients_menu(char brg[5]) { patient patobj; ofstream objoff; char getprv_patno[15]; objoff.open("patientsinfo.dat",ios::binary|ios::app); //************************************************************ clrscr(); intromain(); strcpy(getprv_patno,getpatno()); if(strcmp(getprv_patno,"NULL")!=0) { gotoxy(5,4); cout<<"Previous REGNO: "<<getprv_patno; } //************************************** patobj.create_patient(brg); objoff.write((char*)&patobj,sizeof(patient)); objoff.close(); //*********now decrease one from the stock of blood clrscr(); intromain(); //***********check the available with compatibility and decrease one from it display_bloodavailable(brg); char blgroup[5]; //************************************************************************ gotoxy(10,15); cout<<"Enter the blood group ::"; gotoxy(60,15); cin>>blgroup; decrease_bloodstock(blgroup); //*********now decrease one from the stock of blood getch(); } //**************patient previous no //************get thje donars last number**************** char *getpatno() { ifstream objiff;
  • 35. patient st; int count=0; char tmpregno[15]; objiff.open("patientsinfo.dat",ios::binary); objiff.seekg(0,ios::beg); if(!objiff) { cout<<"File could not be open !! Press any Key..."; getch(); } //**************temporary hiding these lines while(objiff.read((char *) &st, sizeof(patient))) { count++; } //***********jump to the last line objiff.seekg(count-sizeof(st),ios::beg); objiff.read((char *) &st, sizeof(patient)); strcpy(tmpregno,st.getpno()); objiff.close(); if(count!=0) return tmpregno; else return "NULL"; } //************get thje donars last number**************** //**************patient previous no //******************all the donars fuction details****************************
  • 36. if choice is 1: If choice 1 in sub menu:
  • 37. Choice is 1 if choice 2: if choice 2 modify the donars informtion:
  • 38. If choice is 1: from the main menu If choice is 3 Choice 1: Choice 2: Choice 3:
  • 40. REQUIREMENTS HARDWARE REQUIRED • Printer, to print the required documents of the project • Compact Drive • Processor : intel • Ram : 512 MB or more than 512MB • Harddisk : 80 GB or more than 80GB. SOFTWARE REQUIRED • Operating system : Windows XP • Turbo C++, for execution of program and Ms word, for presentation of output.
  • 41. ADVANTAGES • A patient does not need to wait in long queues. • This software reduces paper work. • It is easy to handle patient’s record. • This software saves the time. • Information of the donors stores permanently. DISADVANTAGES • This system suitable for only small blood banks. • Online facility is not available.
  • 42. CONCLUSION This software is efficient in maintaining donor’s details and can easily perform operations on blood donation’s records. This software also reduces the work load of the blood bank management to know how much blood is available and also keep the records of how many patients get the blood from the blood bank. In future, this system can launch web site for easy online blood banking system.
  • 43. SYSTEM DESIGN Then we began with the design phase of the system. System design is a solution, a “HOW TO” approach to the creation of a new system. It translates system requirements into ways by which they can be made operational. It is a translational from a user oriented document to a document oriented programmers. For that, it provides the understanding and procedural details necessary for the implementation. Here we use Flowchart to supplement the working of the new system. The system thus made should be reliable, durable and above all should have least possible maintenance costs. It should overcome all the drawbacks of the Old existing system and most important of all meet the user requirements.
  翻译: