Contoh program c++ penggunaan fungsi STRCPY

Salam hangan pengunjung yang terhormat,
Posting kali ini, saya akan memberikan sebuah pemrograman sederhana yaitu Contoh program c++ penggunaan fungsi STRCPY. Progam ini disajikan dalam bentuk transaksi penyewaan kamar hotel, dengan judul "HOTEL ALFY"

#include<iostream.h>
#include<conio.h>
#include<stdio.h>

main()
{
char kd_kamar,nm_tamu[20],kd_kls,nm_kls[10],nm_kamar[10];
int  lama,by;
long harga,total;

cout<<"=================================================="<<endl;
cout<<"\t\tHOTEL ALFY \n";
cout<<"=================================================="<<endl;
cout<<"Nama Penginap : ";gets(nm_tamu);
cout<<"=================================================="<<endl;
cout<<"Pilihan Kamar :\n";
cout<<"1.Mawar \n";
cout<<"2.Melati \n";
cout<<"3.Anggrek \n";
cout<<"==================================================="<<endl;
cout<<"Input Pilihan Kamar [1/2/3] : ";cin>>kd_kamar;
cout<<"Input Pilihan Kelas [A.VIP/B.Reguler]   : ";cin>>kd_kls;


if (kd_kamar=='1')
{
     strcpy(nm_kamar,"Mawar");
      if (kd_kls=='a'||kd_kls=='A')
      {strcpy(nm_kls,"VIP");
       by=25000;
       harga=250000;}
      else
      {strcpy(nm_kls,"Reguler");
       by=0;
       harga=250000;}
}
else if (kd_kamar=='2')
{
     strcpy(nm_kamar,"Melati");
  harga=200000;
      if (kd_kls=='a'||kd_kls=='A')
      {strcpy(nm_kls,"VIP");
       by=25000; }
      else
      {strcpy(nm_kls,"Reguler");
       by=0; }
}
else
{
     strcpy(nm_kamar,"Anggrek");
  harga=250000;
      if (kd_kls=='a'||kd_kls=='A')
      {strcpy(nm_kls,"VIP");
       by=25000; }
       else
      {strcpy(nm_kls,"Reguler");
       by=0; }

}

clrscr();

cout<<"\t\tHOTEL ALFY \n";
cout<<"==================================================="<<endl;
cout<<"Nama Penginap  : "<<nm_tamu<<endl;
cout<<"Nama Kamar     : "<<nm_kamar<<endl;
cout<<"Kelas          : "<<nm_kls<<endl;
cout<<"Harga Kamar    : "<<harga<<endl;
cout<<"Biaya Tambahan : "<<by<<endl;
cout<<"Lama Inap      : ";cin>>lama;
cout<<"==================================================="<<endl;
total=lama*harga+by;
cout<<"Total          : "<<total<<endl;
cout<<"==================================================="<<endl;

getch();
}
Berikut adalah tampilan setelah di RUN :
Bagaimana? anda sudah mengerti, sekarang coba anda RUN!
semoga bermanfaat :)
Contoh program c++ penggunaan fungsi STRCPY 9 Out Of 10 Based On 10 Ratings. 9 User Reviews.
Share 'Contoh program c++ penggunaan fungsi STRCPY' On ...

Ditulis oleh: Alfy Maghfira - Wednesday, 10 July 2013

Belum ada komentar untuk "Contoh program c++ penggunaan fungsi STRCPY"

Post a Comment

Perhatian!
Mohon berilah komentar yang membangun dan positf terhadap posting yang anda baca
Terima Kasih :)