#include <iostream.h>
#include <iomanip.h>
#include <stdio.h>
#include <conio.h>
void coba();
struct rumahsakit
{
char id_rs [10];
char nm_rs [20];
char alt [20];
char no_tlp [13];
};
struct dokter
{
char id_d [10];
char nm_d [20];
int kode;
struct rumahsakit rs [3];
};
struct dokter d [100];
main()
{
int a, b, no, jmrs[100];
char adrs;
a=1;
while (a<=2)
{
cout<<"inputkan id dokter : "; gets(d[a].id_d);
cout<<"inputkan nama dokter : "; gets(d[a].nm_d);
cout<<"inputkan kode dokter : "; cin>>d[a].kode;
cout<<endl;
adrs='y';b=0; jmrs[a]=0;
while (adrs=='y')
{
jmrs[a]++;
cout<<"inputkan id.rumah sakit\klinik : "; gets(d[a].rs[b].id_rs);
cout<<"inputkan nama rumah sakit\klinik : "; gets(d[a].rs[b].nm_rs);
cout<<"inputkan alamat rumahsakit\klinik : "; gets(d[a].rs[b].alt);
cout<<"inputkan no.telpon rumahsakit\klinik : "; gets(d[a].rs[b].no_tlp);
cout<<"ada data rumahsakit\klinik lainnya : "; cin>>adrs;
b++;
cout<<endl;
}
cout<<endl<<endl;
a++;
}
cout<<endl<<endl<<endl;
a=1;
while (a<=2)
{
cout<<"DAFTAR RUMAH SAKIT/KLINIK TEMPAT PRAKTEK DOKTER \n\n";
cout<<"id.dokter : "<<setw(10)<<d[a].id_d<<setw(7)<<" "<<"jenis dokter : ";
coba();
cout<<endl;
cout<<"nama dokter : "<<setw(10)<<d[a].nm_d<<endl;
cout<<"------------------------------------------------------------\n";
cout<<"no id.RS/klinik nama RS/klinik alamat no.telp \n";
cout<<"------------------------------------------------------------\n";
b=0;
no=1;
while (b<jmrs[a])
{
cout<<no<<setw(10)<<d[a].rs[b].id_rs<<setw(10)<<d[a].rs[b].nm_rs<<setw(10)
<<d[a].rs[b].alt<<setw(10)<<d[a].rs[b].no_tlp<<endl;
no++;
b++;
}
cout<<"------------------------------------------------------------\n";
cout<<endl<<endl;
a++;
}
getch();
}
void coba ()
{
int a=0;
char jd [15];
if (d[a].kode==1)
strcpy(jd,"dokter umum ");
else if (d[a].kode==2)
strcpy(jd,"dokter spesialis ");
cout<<"jenis dokter : "<<jd<<endl;
}
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