telusuri

Translate

Senin, 22 Februari 2016

PROGRAM C++ TENTANG PERAWATAN KUCING

asalamualaikum wr,wb


 ya disini gw mau ngasih codingan tentang perawatan kucing, codingan ini gw buat untuk tugas gw sih dari dosen di smstr 1, ceritanya dosen belum nyuruh gw udah buat duluan. and hasilnya teman-temen gw pada sibuk ngerjain kalo gw mah santai-santai aja ( heheheheh :D )

oke langsung saja ya nih, codingannya


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
judul()
{
 cout<<"\t\t\t PENITIPAN HEWAN PELIHARAAN "<<endl;
 cout<<"\t\t\t          LIES PET   "<<endl;
 cout<<"\t\t========================================="<<endl;
}
garis()
{ cout<<"=========================================================================="<<endl; }
long totalsub(long hrg,long jh)
{ return(hrg*jh); }
long bayartotal(long ttlbyr,long sbttl)
{ return(ttlbyr+sbttl); }
long kembali(long ubyr,long tbyr)
{ return(ubyr-tbyr); }
main()
{
char out,napetu[99],napem[99],lagi;
int i,j;
long tobay,ubay,ukem;
struct
{
  char kohew[5],koper[5],jeper[20],jehew[20];
  int jumhew,harga;
  long subtotal;
}meong[10];
awal:
clrscr();
tobay=0;
judul();
cout<<"\n1.INPUT"<<endl;
cout<<"2.OUTPUT"<<endl;
cout<<"MAUKAN PILIHAN ANDA : ";cin>>out;
if(out=='1')
goto aa;
else
goto bb;
aa:
clrscr();
judul();
cout<<"Nama Petugas : ";gets(napetu);
strupr(napetu);
cout<<"Nama Pemilik : ";gets(napem);
strupr(napem);
cout<<"\nJumlah Data Peliharaan : ";cin>>j;
cout<<endl;
for(i=1;i<=j;i++)
{
cout<<"Hewan Ke-"<<i<<endl;
cout<<"Kode Jenis Hewan [K/H]  : ";cin>>meong[i].kohew;
cout<<"Pilih"<<endl;
cout<<"1.LUX"<<endl;
cout<<"2.INTENSIF"<<endl;
cout<<"Kode Perawatan[1/2]     : ";cin>>meong[i].koper;
cout<<"Jumlah Hewan            : ";cin>>meong[i].jumhew;
if((strcmp(meong[i].kohew,"K")==0)||(strcmp(meong[i].kohew,"k")==0))
{
  strcpy(meong[i].jehew,"Kucing");
  if(strcmp(meong[i].koper,"1")==0)
  {
     strcpy(meong[i].jeper,"Lux");
     meong[i].harga=250000; }
  else if(strcmp(meong[i].koper,"2")==0)
  {
     strcpy(meong[i].jeper,"Intensif");
   meong[i].harga=300000; }
  else
  {
     strcpy(meong[i].jeper,"kode salah");
     meong[i].harga=0; }
}
else if((strcmp(meong[i].kohew,"H")==0)||(strcmp(meong[i].kohew,"h")==0))
{
  strcpy(meong[i].jehew,"Hamster");
  if(strcmp(meong[i].koper,"1")==0)
  {
     strcpy(meong[i].jeper,"Lux");
     meong[i].harga=150000; }
  else if(strcmp(meong[i].koper,"2")==0)
  {
     strcpy(meong[i].jeper,"Intensif");
     meong[i].harga=100000; }
  else
  {
     strcpy(meong[i].jeper,"kode salah");
     meong[i].harga=0;  }
}
else
{
  strcpy(meong[i].jehew,"kode salah");
  strcpy(meong[i].jeper,"kode salah");
  meong[i].harga=0;
}
}
cout<<endl<<endl;
clrscr();/********************OUTPUT****************/
judul();
cout<<"\nNama Petugas : "<<napetu<<endl;
cout<<"Nama Pemilik : "<<napem<<endl;
cout<<endl;
garis();
cout<<"No   Jenis        Jenis         Biaya            Jumlah       Subtotal"<<endl;
cout<<"     Hewan        Perawatan     Perawatan        Hewan"<<endl;
garis();
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(13)<<meong[i].jehew;
cout<<setiosflags(ios::left)<<setw(14)<<meong[i].jeper;
cout<<setiosflags(ios::left)<<"RP. "<<setw(13)<<meong[i].harga;
cout<<setiosflags(ios::left)<<setw(13)<<meong[i].jumhew;
meong[i].subtotal=totalsub(meong[i].harga,meong[i].jumhew);
cout<<setiosflags(ios::left)<<"RP. "<<setw(1)<<meong[i].subtotal<<endl;
tobay=bayartotal(tobay,meong[i].subtotal);
}
garis();
cout<<"\t\t\t\t\t       Total Bayar  : Rp. "<<tobay<<endl;
cout<<"\t\t\t\t\t       Uang Bayar   : Rp. ";cin>>ubay;
ukem=kembali(ubay,tobay);
cout<<"\t\t\t\t\t       Uang Kembali : Rp. "<<ukem<<endl;
cout<<endl<<endl;
gotoxy(3,14+j);cout<<"INPUT DATA LAGI [Y/T] : ";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto awal;
else {
clrscr();
cout<<"\n\n\n\t\t\t***** N U H U N *******"<<endl;
getch();
}
bb:
}



ya semoga bermanfaat ya amin

wasalam

#thelost

Tidak ada komentar:

Posting Komentar