#include <iostream.h>
#include <conio.h>
#include <fstream.h>
#include <stdio.h>
#include <stdlib.h>
struct pasien {
char no [10];
char nama [20];
char tanggal [11];
char umur [5];
char kode[3];
} data;
main ()
{
int jumlah;
ofstream datafile ("pasien.dat",ios::out);
if (!datafile)
{
cerr<<"FILE COULD NOT BE OPENED"<<endl;
exit(1);
}
char ulang = 'Y'; jumlah=0;
clrscr();
cout<<"INPUT DATA PASIEN RUMAH SAKIT"<<endl;
cout<<"============================="<<endl<<endl;
while (ulang=='Y')
{
cout<<"DATA PASIEN KE - "<<(jumlah+1)<<endl;
cout<<"NO. PASIEN : ";gets (data.no);
cout<<"NAMA PASIEN : ";gets (data.nama);
cout<<"TANGGAL REGISTRASI : ";gets (data.tanggal);
cout<<"UMUR PASIEN : ";gets (data.umur);
cout<<"KODE PENYAKIT : ";gets (data.kode);
cout<<endl;
datafile.write ((char*)& data,sizeof(data));
cout<<"ADA DATA PASIEN LAINNYA? [Y/N] : ";cin>>ulang;
cout<<endl;
jumlah++;
}
datafile.close();
}
Subscribe to:
Post Comments (Atom)
CONTOH CODING LINKED LIST MENGGUNAKAN BORLAND C++
CONTOH CODING LINKED LIST MENGGUNAKAN BORLAND C++ #include<stdlib.h> #include<conio.h> #include<iostream.h> struc...
-
#include <iostream.h> #include <conio.h> #include <fstream.h> #include <stdio.h> #include <stdlib.h> struct pa...
-
#include <iostream.h> #include <conio.h> #include <fstream.h> #include <stdio.h> #include <iomanip.h> #include...
-
#include <iostream.h> #include <iomanip.h> #include <stdio.h> #include <conio.h> void coba(); struct rumahsakit { ...
No comments:
Post a Comment