caranya : ketik program
#include <iostream.h>
#include <conio.h>
#include <windows.h>
class obat {
public:
char
kode_obat[150][100];
char nama_obat[100][100];
char
spesifikasi[100][100];
};
class pasien {
public:
char
no_rm[200][200];
char
nama_pasien[100][100];
char
alamat[100][100];
char
jenis_kelamin[200][100];
char
agama[200][100];
char
status_nikah[200][100];
};
class dokter {
public:
char
kode_dokter[100][100];
char
nama_dokter[150][100];
char
alamat[100][100];
char
no_telepon[100][100];
};
class kamar {
public:
char
kode_kamar[100][100];
char
nama_kamar[150][100];
char
spesifikasi_kamar[101][101];
};
class utama {
public:
void menu_utama(){
obat
a;
pasien b;
dokter c;
kamar d;
int pilih;
do{
clrscr();
cout<<"################;-)Selamat
Belajar#############;-)"<<endl;
cout<<"
Menu Utama
"<<endl;
cout<<"#############;-)Pemrograman
system;-);-)"<<endl;
cout<<"1. Data Obat "<<endl;
cout<<"2. Data Pasien "<<endl;
cout<<"3. Data Dokter "<<endl;
cout<<"4. Data Kamar "<<endl;
cout<<"5. Keluar"<<endl;
cout<<"Silahkan masukkan pilihan anda[1.....5] ";
cin>>pilih;
switch(pilih){
case 1:
obat
a;
int
jml,pilihan;
do{
clrscr();
cout<<"--------------------------"<<endl;
cout<<" Menu
Obat "<<endl;
cout<<"--------------------------"<<endl;
cout<<"1.
Banyak Data Obat "<<endl;
cout<<"2.
Input Data Obat "<<endl;
cout<<"3. Tampil Data Obat "<<endl;
cout<<"4.
Kembali Ke Menu Utama "<<endl;
cout<<"Silahkan
masukkan pilihan anda[1....4] : ";
cin>>pilihan;
switch(pilihan){
case
1:
cout<<endl;
cout<<"Masukkan
Banyak Obat"<<" : ";
cin>>jml;
getch();
break;
case
2: {
cout<<endl;
for(int i=1; i<=jml; i++)
{
cout<<"Data ke : "
<<i<<endl;
cout<<"Kode Obat
: "; cin>>a.kode_obat[i];
cout<<"Nama Obat
: "; cin>>a.nama_obat[i];
cout<<"Spesifikasi
: " ; cin>>a.spesifikasi[i];
cout<<endl;
}
getch();
break;
}
case
3: {
cout<<endl;
for(int i=1; i<=jml; i++)
{
cout<<"data ke : "<<i<<endl;
cout<<"Kode Obat : "<<a.kode_obat[i]<<endl;
cout<<"Nama Obat :
"<<a.nama_obat[i]<<endl;
cout<<"Spesifikasi
: "<<a.spesifikasi[i]<<endl;
cout<<endl;
}
getch();
break;
}
}
}while(pilihan!=4);
getch();
getch();
break;
case 2:
pasien
b;
int
j,pilih;
do{
clrscr();
cout<<"(-;(-;(-;(-;(-;(-;(-;(-;(-;"<<endl;
cout<<" Menu Pasien "<<endl;
cout<<"--------------------------"<<endl;
cout<<"1. Banyak Data Pasien "<<endl;
cout<<"2. Input Data
Pasien "<<endl;
cout<<"3.
Tampil Data Pasien "<<endl;
cout<<"4.
Kembali Ke menu Utama "<<endl;
cout<<"Silahkan
masukkan pilihan anda[1....4] ";
cin>>pilih;
switch(pilih){
case
1:
cout<<endl;
cout<<"Masukkan Banyak Pasien"<<" : ";
cin>>j;
getch();
break;
case
2: {
cout<<endl;
for(int i=1; i<=j; i++)
{
cout<<"Data ke : "<<i<<endl;
cout<<"No. Rm
: "; cin>>b.no_rm[i];
cout<<"Nama Pasien
: "; cin>>b.nama_pasien[i];
cout<<"Alamat : "; cin>>b.alamat[i];
cout<<"Jenis Kelamin : "; cin>>b.jenis_kelamin[i];
cout<<"Agama :
"; cin>>b.agama[i];
cout<<"Status Nikah : "; cin>>b.status_nikah[i];
cout<<endl;
}
getch();
break;
}
case
3:{
cout<<endl;
for(int i=1; i<=j; i++)
{
cout<<"Data ke :
"<<i<<endl;
cout<<"No. Rm : "<<b.no_rm[i]<<endl;
cout<<"Nama Pasien :
"<<b.nama_pasien[i]<<endl;
cout<<"Alamat :
"<<b.alamat[i]<<endl;
cout<<"Jenis Kelamin
:"<<b.jenis_kelamin[i]<<endl;
cout<<"Agama
:"<<b.agama[i]<<endl;
cout<<"Status Nikah
:"<<b.status_nikah[i]<<endl;
cout<<endl;
}
getch();
break;
}
}
}while(pilih!=4);
getch();
getch();
break;
case 3:
dokter c;
int
jmlahkan,pilh;
do{
clrscr();
cout<<"okeokeokeokeokeokeokeokeoke"<<endl;
cout<<" Menu
Dokter "<<endl;
cout<<"yesyesyesyesyesyesyesyesyesyes"<<endl;
cout<<"1.
Banyak Data Dokter "<<endl;
cout<<"2.
Input Data Dokter "<<endl;
cout<<"3. Tampil Data Dokter "<<endl;
cout<<"4.
Kembali Ke Menu Utama "<<endl;
cout<<"Silahkan
masukkan pilihan anda[1....4] ";
cin>>pilh;
switch(pilh){
case
1:
cout<<endl;
cout<<"Masukkan Banyak Dokter"<<" : ";
cin>>jmlahkan;
getch();
break;
case
2:
{
cout<<endl;
for(int i=1; i<=jmlahkan; i++)
{
cout<<"Data ke : "<<i<<endl;
cout<<"Kode Dokter
: "; cin>>c.kode_dokter[i];
cout<<"Nama Dokter
: "; cin>>c.nama_dokter[i];
cout<<"Alamat Dokter :
"; cin>>c.alamat[i];
cout<<"No Telepon
: "; cin>>c.no_telepon[i];
cout<<endl;
}
getch();
break;
}
case
3:{
cout<<endl;
for(int i=1; i<=jmlahkan; i++)
{
cout<<"Data ke : "<<i<<endl;
cout<<"Kode Dokter
: "<<c.kode_dokter[i]<<endl;
cout<<"Nama Dokter
: "<<c.nama_dokter[i]<<endl;
cout<<"Alamat Dokter :
"<<c.alamat[i]<<endl;
cout<<"No Telepon
: "<<c.no_telepon[i]<<endl;
cout<<endl;
}
getch();
break;
}
}
}while(pilh!=4);
getch();
getch();
break;
case 4:
kamar
d;
int
jumlah,pilihanmu;
do{
clrscr();
cout<<"--------------------------"<<endl;
cout<<" Menu
Kamar "<<endl;
cout<<"--------------------------"<<endl;
cout<<"1.
Banyak Data Kamar "<<endl;
cout<<"2.
Input Data Kamar "<<endl;
cout<<"3. Tampil Data Kamar "<<endl;
cout<<"4.
Kembali Ke Menu Utama "<<endl;
cout<<"Silahkan
masukkan pilihan anda[1....4] : ";
cin>>pilihanmu;
switch(pilihanmu){
case
1:
cout<<endl;
cout<<"Masukkan
Banyak Kamar"<<" : ";
cin>>jumlah;
getch();
break;
case 2:
{
cout<<endl;
for(int i=1; i<=jumlah; i++)
{
cout<<"Data ke : "
<<i<<endl;
cout<<"Kode Kamar
: "; cin>>d.kode_kamar[i];
cout<<"Nama Kamar
: "; cin>>d.nama_kamar[i];
cout<<"Spesifikasi kamar
: " ; cin>>d.spesifikasi_kamar[i];
cout<<endl;
}
getch();
break;
}
case
3: {
cout<<endl;
for(int i=1; i<=jumlah; i++)
{
cout<<"Data ke : "<<i<<endl;
cout<<"Kode Kamar :
"<<d.kode_kamar[i]<<endl;
cout<<"Nama
Kamar :
"<<d.nama_kamar[i]<<endl;
cout<<"Spesifikasi Kamar
: "<<d.spesifikasi_kamar[i]<<endl;
cout<<endl;
}
getch();
break;
}
}
}while(pilihan!=4);
getch();
getch();
break;
}
}while(pilih!=4);
getch();
}
};
void main (){
utama data;
data.menu_utama();
}
Hasil Eksekusi:
Posting Komentar