J
Jinsu Jais
Dear guys,
I am a student who had started learning Turbo c++ yet one year. I know
only the basics of the c++. But now its my turn to make a project in
our school. So I decided to start a project which doesn't use any
graphical support in c++. So I prefer a Blood Bank management system.
But I am not sure that is my project is perfect. So my friends, PLEASE
HELP ME TO MAKE A PERFECT ERROR-FREE PROJECT. Also advice me some other
projects with the codes so that I can implement it. I am adding my code
here.
NEED AN URGENT REPLY TO : (e-mail address removed) or (e-mail address removed)
Jinsu M Jais
// A BLOOD BANK MANAGEMENT SYSTEM
#include<fstream.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
class DONOR
{
char name[20];
char dob[9];
char address[30];
int phone_no;
char blood_gr[4];
public:
DONOR()
{
phone_no=0;
}
void accept();
void display();
void save();
char *return_group();
};
char *DONOR::return_group()
{
return blood_gr;
}
void DONOR::accept()
{
clrscr();
cout<<"\t\t\tDONOR DETAILS";
cout<<"\nEnter NAME: ";
gets(name);
cout<<"\nEnter Address : ";
gets(address);
cout<<"\nEnter Date of Birth : ";
gets(dob);
cout<<"\nEnter Phone Number : ";
cin>>phone_no;
cout<<"\nEnter Blood Group : ";
gets(blood_gr);
}
void DONOR::display()
{
clrscr();
cout<<"\t\t\tDONOR DETAILS";
cout<<"\nNAME : ";
puts(name);
cout<<"\nAddress : ";
puts(address);
cout<<"\nDate Of Birth : ";
puts(dob);
cout<<"\nPhone Number : "<<phone_no;
cout<<"\nBlood Group : ";
puts(blood_gr);
getch();
}
void DONOR::save()
{
fstream dfile;
DONOR DD;
dfile.open("DONOR.dat",ios::app);
dfile.write((char *)&DD,sizeof(DD));
dfile.close();
}
class node
{
DONOR record;
public:
node *next;
void append();
void display();
void save();
void query(char b_group[40]);
node()
{
next=NULL;
}
};
void node::append()
{
record.accept();
next=NULL;
}
void node::display()
{
record.display();
}
void node::save()
{
record.save();
}
void node::query(char b_group[40])
{
if(strcmp(record.return_group(),b_group)==0)
display();
}
class list
{
node *first,*last;
public:
list()
{
first=NULL;
last=NULL;
}
void append();
void save(node *ptr);
void display();
void query();
void open();
};
void list::save(node *ptr)
{
ptr->save();
}
void list::append()
{
node *ptr;
ptr=new node;
ptr->append();
if(first==NULL)
first=last=ptr;
else
{
last->next=ptr;
last=ptr;
}
save(ptr);
}
void list::display()
{
node *ptr;
ptr=first;
while(ptr!=NULL)
{
ptr->display();
ptr=ptr->next;
}
}
void list::query()
{
clrscr();
char b_group[4];
node *ptr;
cout<<"\t\tDONOR DETAILS";
cout<<"\nBlood Group : ";
cin>>b_group;
for(ptr=first;ptr;ptr=ptr->next)
ptr->query(b_group);
}
void main()
{
int ch;
list LIST;
do
{
clrscr();
cout<<"\t\t\tDONOR DETAILS";
cout<<"\n\t1: Append Records";
cout<<"\n\t2: Display Records";
cout<<"\n\t3: Query on blood group";
cout<<"\n\t4: End the program";
cout<<"\n\nEnter your choice : ";
cin>>ch;
switch(ch)
{
case 1:
LIST.append();
break;
case 2:
LIST.display();
break;
case 3:
LIST.query();
break;
case 4:
cout<<"\nEnd of the program";
getch();
break;
}
}while(ch!=4);
}
I am a student who had started learning Turbo c++ yet one year. I know
only the basics of the c++. But now its my turn to make a project in
our school. So I decided to start a project which doesn't use any
graphical support in c++. So I prefer a Blood Bank management system.
But I am not sure that is my project is perfect. So my friends, PLEASE
HELP ME TO MAKE A PERFECT ERROR-FREE PROJECT. Also advice me some other
projects with the codes so that I can implement it. I am adding my code
here.
NEED AN URGENT REPLY TO : (e-mail address removed) or (e-mail address removed)
Jinsu M Jais
// A BLOOD BANK MANAGEMENT SYSTEM
#include<fstream.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
class DONOR
{
char name[20];
char dob[9];
char address[30];
int phone_no;
char blood_gr[4];
public:
DONOR()
{
phone_no=0;
}
void accept();
void display();
void save();
char *return_group();
};
char *DONOR::return_group()
{
return blood_gr;
}
void DONOR::accept()
{
clrscr();
cout<<"\t\t\tDONOR DETAILS";
cout<<"\nEnter NAME: ";
gets(name);
cout<<"\nEnter Address : ";
gets(address);
cout<<"\nEnter Date of Birth : ";
gets(dob);
cout<<"\nEnter Phone Number : ";
cin>>phone_no;
cout<<"\nEnter Blood Group : ";
gets(blood_gr);
}
void DONOR::display()
{
clrscr();
cout<<"\t\t\tDONOR DETAILS";
cout<<"\nNAME : ";
puts(name);
cout<<"\nAddress : ";
puts(address);
cout<<"\nDate Of Birth : ";
puts(dob);
cout<<"\nPhone Number : "<<phone_no;
cout<<"\nBlood Group : ";
puts(blood_gr);
getch();
}
void DONOR::save()
{
fstream dfile;
DONOR DD;
dfile.open("DONOR.dat",ios::app);
dfile.write((char *)&DD,sizeof(DD));
dfile.close();
}
class node
{
DONOR record;
public:
node *next;
void append();
void display();
void save();
void query(char b_group[40]);
node()
{
next=NULL;
}
};
void node::append()
{
record.accept();
next=NULL;
}
void node::display()
{
record.display();
}
void node::save()
{
record.save();
}
void node::query(char b_group[40])
{
if(strcmp(record.return_group(),b_group)==0)
display();
}
class list
{
node *first,*last;
public:
list()
{
first=NULL;
last=NULL;
}
void append();
void save(node *ptr);
void display();
void query();
void open();
};
void list::save(node *ptr)
{
ptr->save();
}
void list::append()
{
node *ptr;
ptr=new node;
ptr->append();
if(first==NULL)
first=last=ptr;
else
{
last->next=ptr;
last=ptr;
}
save(ptr);
}
void list::display()
{
node *ptr;
ptr=first;
while(ptr!=NULL)
{
ptr->display();
ptr=ptr->next;
}
}
void list::query()
{
clrscr();
char b_group[4];
node *ptr;
cout<<"\t\tDONOR DETAILS";
cout<<"\nBlood Group : ";
cin>>b_group;
for(ptr=first;ptr;ptr=ptr->next)
ptr->query(b_group);
}
void main()
{
int ch;
list LIST;
do
{
clrscr();
cout<<"\t\t\tDONOR DETAILS";
cout<<"\n\t1: Append Records";
cout<<"\n\t2: Display Records";
cout<<"\n\t3: Query on blood group";
cout<<"\n\t4: End the program";
cout<<"\n\nEnter your choice : ";
cin>>ch;
switch(ch)
{
case 1:
LIST.append();
break;
case 2:
LIST.display();
break;
case 3:
LIST.query();
break;
case 4:
cout<<"\nEnd of the program";
getch();
break;
}
}while(ch!=4);
}