//BLOOD BANK MANAGEMENT SYSTEM// -
#include<iostream.h>
-
#include<conio.h>
-
#include<fstream.h>
-
#include<string.h>
-
#include<stdio.h>
-
#include<process.h>
-
fstream file;
-
fstream file1;
-
class donor
-
{ int num;
-
char name[20];
-
char dob[9];
-
char address[30];
-
int phone_no;
-
char blood_gr;
-
public:
-
void accept();
-
void display();
-
void query();
-
void modify();
-
void del();
-
char return_group()
-
{return blood_gr;}
-
int return_num()
-
{return num;}
-
}s1;
-
-
void donor::accept()
-
{
-
file.open("Don.dat",ios::app|ios::in|ios::out|ios::binary);
-
clrscr();
-
cout<<"\t\t\tDONOR DETAILS";
-
cout<<"\nEnter Donor no: ";
-
cin>>num;
-
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 : ";
-
cin>>blood_gr;
-
file.write((char *)&s1,sizeof(s1));
-
getch();
-
file.close();
-
};
-
-
void donor::display()
-
{
-
file.open("Don.dat",ios::app|ios::in|ios::out|ios::binary|ios::beg);
-
while(!file.eof())
-
{file.read((char *)&s1,sizeof(s1));
-
clrscr();
-
cout<<"\t\t\tDONOR DETAILS";
-
cout<<"\n\nDonor no : ";
-
cout<<num;
-
cout<<"\n\nNAME : ";
-
puts(name);
-
cout<<"\n\nAddress : ";
-
puts(address);
-
cout<<"\n\nDate Of Birth : ";
-
puts(dob);
-
cout<<"\n\nPhone Number : ";
-
cout<<phone_no;
-
cout<<"\n\n\nBlood Group : ";
-
cout<<blood_gr;
-
getch();
-
}
-
file.close();
-
};
-
-
void donor::modify()
-
{
-
file.open("Don.dat",ios::app|ios::in|ios::out|ios::beg|ios::binary);
-
int recno;
-
long pos;
-
char nam[20];
-
char dob1[9];
-
char address1[30];
-
int phone_no1;
-
char blood_gr1;
-
cout<<"\nEnter the record number you want to modify : ";
-
cin>>recno;
-
while(!file.eof())
-
{pos=file.tellg();
-
file.read((char *)&s1,sizeof(s1));
-
if(s1.return_num()==recno)
-
{
-
cout<<"\nEnter Name: ";
-
gets(nam);
-
cout<<"\nEnter Address : ";
-
gets(address1);
-
cout<<"\nEnter Date of Birth : ";
-
gets(dob1);
-
cout<<"\nEnter Phone Number : ";
-
cin>>phone_no1;
-
cout<<"\nEnter Blood Group : ";
-
cin>>blood_gr1;
-
name[20]=nam[20];
-
address[30]=address1[30];
-
dob[9]=dob1[9];
-
phone_no=phone_no1;
-
blood_gr=blood_gr1;
-
file.seekg(pos);
-
file.write((char *)&s1,sizeof(s1));
-
break;
-
}
-
}
-
getch();
-
file.close();
-
}
-
-
void donor::query()
-
{
-
file.open("Don.dat",ios::app|ios::in|ios::out|ios::beg|ios::binary);
-
char bldgr;
-
cout<<"Enter the blood group you want to query\n ";
-
cin>>bldgr;
-
while(!file.eof())
-
{
-
file.read((char *)&s1,sizeof(s1));
-
if(s1.return_group()==bldgr)
-
{
-
s1.display();
-
getch();
-
break;
-
}
-
}
-
file.close();
-
};
-
-
void donor::del()
-
{
-
file.open("Don.dat",ios::app|ios::in|ios::out|ios::beg|ios::binary);
-
file1.open("temp.dat",ios::app|ios::in|ios::out|ios::beg|ios::binary);
-
int rec;
-
char found='f',confirm='n';
-
cout<<"\nEnter the record number you wish to delete : ";
-
cin>>rec;
-
while(!file.eof())
-
{ file.read((char *)&s1,sizeof(s1));
-
if(s1.return_num()==rec)
-
{ s1.display();
-
found='t';
-
cout<<"\nAre you sure you want to delete this record? (y/n) ";
-
cin>>confirm;
-
if(confirm=='n')
-
file1.write((char *)&s1,sizeof(s1));
-
}
-
else
-
file1.write((char *)&s1,sizeof(s1));
-
}
-
if(found=='f')
-
cout<<"\nRecord not found";
-
file.close();
-
file1.close();
-
remove("Don.dat");
-
rename("temp.dat","Don.dat");
-
}
-
-
void main()
-
{
-
int ch;
-
do
-
{
-
clrscr();
-
cout<<"\t\t\tBLOOD BANK MANAGEMENT PROGRAM";
-
cout<<"\n\n\tDONOR DETAILS\n";
-
cout<<"\n\n\t1: Append Records";
-
cout<<"\n\n\t2: Display Records";
-
cout<<"\n\n\t3: Query on blood group";
-
cout<<"\n\n\t4: Modify existing Records";
-
cout<<"\n\n\t5: Delete existing Records";
-
cout<<"\n\n\t6: End the program";
-
cout<<"\n\nEnter your choice (1-6) : ";
-
cin>>ch;
-
switch(ch)
-
{
-
case 1:
-
s1.accept();
-
break;
-
case 2:
-
s1.display();
-
break;
-
case 3:
-
s1.query();
-
break;
-
case 4:
-
s1.modify();
-
break;
-
case 5:
-
s1.del();
-
break;
-
case 6:
-
cout<<"\nEnd of the program";
-
getch();
-
break;
-
}
-
}while(ch!=6);
-
}
-
In the above program the query and the delete function goes on endlessly displaying the record.while int display function the same record gets displayed twice.also in modify function the new details are not being overwritten .they are being added as a new record.Please help me out.Thanks in advacne.This program was coded using TURBO C++ V3.0.
0 1661 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Robertb |
last post by:
I'm driving myself crazy trying to figure this one out. So much so
that I think I'm within walking distance now!
The program is written and compiled in Visual Basic 6 with SP5. The
OS is Windows XP Professional.
The other day, it worked just fne. Today it doesn't. I had this same
problem a few weeks ago, but it mysteriously went away. Well, now
it's back. What did I change? I have no idea. Lot's of stuff, I
suppose. I don't...
|
by: Bruce Davis |
last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded
tkinter gui application. The problem appears to be a deadlock condition
when a child thread pops up a
Pmw dialog window in the context of a main window. The problem does not
occur on HPUX or Linux. The following simple example code illustrates
the problem and the work around
I've come up with; However, I'd like, very much, to get rid of the kludgy
work around....
|
by: Refky Wahib |
last post by:
Hi
I need Technical Support
I finished a Great project using .Net and SQL Server and .Net Mobile
Control
My Business case is to implement this Program to accept about 1
Million concurrent users
So I designed the project as master Node that has all administration
|
by: harry |
last post by:
Hi,
I have a program that runs on multiple client pc's. Occasionally one or more
of those pc's use VPN to connect to another corporate network. When using
VPN they need to set proxy server in Internet Explorer connection settings
(proxy:8080). However, as soon as this setting is enabled, the remoting
program running on their pc stops communicating with the server it sends
data to. I've disabled proxy setting on the affected pc, rebooted...
|
by: Peter Olcott |
last post by:
www.halting-problem.com
| |
by: Ian Stanley |
last post by:
Hi,
Continuing my strcat segmentation fault posting-
I have a problem which occurs when appending two sting literals using
strcat.
I have tried to fix it by writing my own function that does the strcat
(mystract). Program below.
However this appears not to have fixed the problem and I don't know why it
shouldn't ?
Any further help as to what else I am doing wrong will be appreciated
regards
|
by: Refky Wahib |
last post by:
Hi
Actually I need Technical Support
I finished a Great project using .Net and SQL Server and .Net Mobile
Control
My Business case is to implement this Program to accept about 1
Million concurrent users
So I designed the project as master Node that has all administration
project and about 10 client Nodes
Those subscribers will login and I configured the replication at
Server that can publish any change to the Nodes
|
by: Sarah |
last post by:
I need to access some data on a server. I can access it directly using UNC
(i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network
drive resource (S:\Path\FileName).
Here is my problem: my vb.net program has problems with UNC. If the UNC
server is restarted or goes off-line, my VB.net program crashes. The code
for UNC access to the file is included below and is put in the tick event of
a form timer control running every...
|
by: Prasad |
last post by:
HI,
I am a beginner in VC++..
I am trying to write a Win32 console application in visual studio..
I am using following header files..
#include <STRING>
using namespace std;
#include <hash_map>//from Standard template library
//and some other headers
|
by: Mr. Beck |
last post by:
Hello,
Please Help.....
I have been working with some tcp/ip socket communication within a C#
program recently. Basicly, I have a program (myProblemProgram) that has a
socket connected to another program for information passing. Upon receiving
a particular "command" from the the information passing program,
myProblemProgram will launch a separate thread to do individual communication
with another file transfer program. The thread...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |