Program Penitipan Hewan C++ |
- Kita Mulai Ke tahap awal Dengan cara buka Borlan Satr Lalu Cari Program borlan ter sebut Yang Belumpunya Bisa Download Di sini Borland C++
- Selanjutnya Kita copy coding dibawah box ini ...
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
judul ()
{
puts("Penitipan Hewan Peliharaan");
puts("\t\tMeaow Pet Care");
puts("---------------------------");
}
total_bayar(long totalbayar,long subtotal)
{return(totalbayar + subtotal);}
main()
{
struct
{
char kh,kp,jh[10],jp[10];
int jml;
long biaya,sub;
}hewan[5];
char nm_petugas[10],nm_pemilik[10];
int i,j;
long totbay =0,ubay,ukem;
clrscr();
cout<<"Nama Petugas :";cin>>nm_petugas;
cout<<"Nama Pemilik :";cin>>nm_pemilik;
cout<<"Jumlah Data :";cin>>j;
for(i=1;i<=j;i++)
{cout<<"Hewan Ke -"<<i<<endl;
cout<<"Kode Hewan :";cin>>hewan[i].kh;
cout<<"Kode Perawatan :";cin>>hewan[i].kp;
cout<<"Jumlah Hewan :";cin>>hewan[i].jml;
if(hewan[i].kh=='K'||hewan[i].kh=='k')
{strcpy(hewan[i].jh,"KUCING");
if(hewan[i].kp=='1')
{strcpy(hewan[i].jp,"Lux");
hewan[i].biaya=250000;
}
else if(hewan[i].kp=='2')
{strcpy(hewan[i].jp,"Intensif");
hewan[i].biaya=300000;
}
}
if(hewan[i].kh=='H'||hewan[i].kh=='h')
{strcpy(hewan[i].jh,"HAMSTER");
if(hewan[i].kp=='1')
{strcpy(hewan[i].jp,"Lux");
hewan[i].biaya=150000;
}
else if(hewan[i].kp=='2')
{strcpy(hewan[i].jp,"Intensif");
hewan[i].biaya=100000;
}
}
hewan[i].sub=hewan[i].biaya*hewan[i].jml;
totbay=total_bayar(hewan[i].sub,totbay);
}
cout<<"Nama Petugas :"<<nm_petugas<<endl;
cout<<"Nama Pemilik :"<<nm_pemilik<<endl;
cout<<"----------------------"<<endl;
puts("No Jenis Jenis Biaya Jumlah SubTotal");
puts(" Hewan Perawatan Perawatan Hewan ");
puts("----------------------------------------------------------");
for(i=1;i<=j;i++)
{cout<<setiosflags(ios::left)<<setw(3)<<i;
cout<<setiosflags(ios::left)<<setw(15)<<hewan[i].jh;
cout<<setiosflags(ios::left)<<setw(15)<<hewan[i].jp;
cout<<setiosflags(ios::left)<<setw(10)<<hewan[i].biaya;
cout<<setiosflags(ios::left)<<setw(10)<<hewan[i].jml;
cout<<setiosflags(ios::left)<<setw(15)<<hewan[i].sub<<endl;
cout<<"Total Bayar :"<<totbay<<endl;
cout<<"Uang Bayar :";cin>>ubay;
ukem = ubay - totbay;
cout<<"Uang Kembali :"<<ukem<<endl;
}
getch();
}
#include<conio.h>
#include<iostream.h>
#include<iomanip.h>
judul ()
{
puts("Penitipan Hewan Peliharaan");
puts("\t\tMeaow Pet Care");
puts("---------------------------");
}
total_bayar(long totalbayar,long subtotal)
{return(totalbayar + subtotal);}
main()
{
struct
{
char kh,kp,jh[10],jp[10];
int jml;
long biaya,sub;
}hewan[5];
char nm_petugas[10],nm_pemilik[10];
int i,j;
long totbay =0,ubay,ukem;
clrscr();
cout<<"Nama Petugas :";cin>>nm_petugas;
cout<<"Nama Pemilik :";cin>>nm_pemilik;
cout<<"Jumlah Data :";cin>>j;
for(i=1;i<=j;i++)
{cout<<"Hewan Ke -"<<i<<endl;
cout<<"Kode Hewan :";cin>>hewan[i].kh;
cout<<"Kode Perawatan :";cin>>hewan[i].kp;
cout<<"Jumlah Hewan :";cin>>hewan[i].jml;
if(hewan[i].kh=='K'||hewan[i].kh=='k')
{strcpy(hewan[i].jh,"KUCING");
if(hewan[i].kp=='1')
{strcpy(hewan[i].jp,"Lux");
hewan[i].biaya=250000;
}
else if(hewan[i].kp=='2')
{strcpy(hewan[i].jp,"Intensif");
hewan[i].biaya=300000;
}
}
if(hewan[i].kh=='H'||hewan[i].kh=='h')
{strcpy(hewan[i].jh,"HAMSTER");
if(hewan[i].kp=='1')
{strcpy(hewan[i].jp,"Lux");
hewan[i].biaya=150000;
}
else if(hewan[i].kp=='2')
{strcpy(hewan[i].jp,"Intensif");
hewan[i].biaya=100000;
}
}
hewan[i].sub=hewan[i].biaya*hewan[i].jml;
totbay=total_bayar(hewan[i].sub,totbay);
}
cout<<"Nama Petugas :"<<nm_petugas<<endl;
cout<<"Nama Pemilik :"<<nm_pemilik<<endl;
cout<<"----------------------"<<endl;
puts("No Jenis Jenis Biaya Jumlah SubTotal");
puts(" Hewan Perawatan Perawatan Hewan ");
puts("----------------------------------------------------------");
for(i=1;i<=j;i++)
{cout<<setiosflags(ios::left)<<setw(3)<<i;
cout<<setiosflags(ios::left)<<setw(15)<<hewan[i].jh;
cout<<setiosflags(ios::left)<<setw(15)<<hewan[i].jp;
cout<<setiosflags(ios::left)<<setw(10)<<hewan[i].biaya;
cout<<setiosflags(ios::left)<<setw(10)<<hewan[i].jml;
cout<<setiosflags(ios::left)<<setw(15)<<hewan[i].sub<<endl;
cout<<"Total Bayar :"<<totbay<<endl;
cout<<"Uang Bayar :";cin>>ubay;
ukem = ubay - totbay;
cout<<"Uang Kembali :"<<ukem<<endl;
}
getch();
}
- Lalu Kita Compiler coding tsb
- Selesai
ARTIKEL TERKAIT: