IT COMPUTER SOLUTION

Tidak ada kata"TIDAK BISA" Selagi kita mau mencoba

Latihan c++ “Losmen adem ayem”

Posted by ComputerSolution on 6 November 2013

#include <conio.h>
#include <stdio.h>
#include <iostream.h>
main()
{
int lama;
long hrg,jmlh;
float dskn,tot,byr,kembali;
char ptgs[20],cstmr[20],tgl[15],kk,kamar[15],ulg;
start:
puts(“\t\tLOSMEN ADEM AYEM”);
puts(“\t\t****************\n”);
printf(“Input Nama Petugas \t: “); scanf(“%s”,&ptgs);
printf(“Input Nama Customer \t: “); scanf(“%s”,&cstmr);
printf(“Input Tanggal Check In \t: “); scanf(“%s”,&tgl);
puts(“\n************************************************”);
kamar:
printf(“\nPilih kode Kamar[L/S/M]\t:”); scanf(“%s”,&kk);
printf(“Input Lama Sewa \t:”); scanf(“%d”,&lama);
if(kk==’L’||kk==’l’)
{
strcpy(kamar,”Lily”);
hrg=250000;
}
else if(kk==’S’||kk==’s’)
{
strcpy(kamar,”Sakura”);
hrg=150000;
}
else if(kk==’M’||kk==’m’)
{
strcpy(kamar,”Mawar”);
hrg=75000;
}
else
{
clrscr();
puts(“Kode Kamar Salah!!!”);
goto kamar;
}
jmlh=hrg*lama;
if(lama>3 && lama<5) { dskn=jmlh*0.05; } else if(lama>5)
{
dskn=jmlh*0.1;
}
else
{
dskn=0;
}
tot=jmlh-dskn;
clrscr();
puts(“\n\t\tKwitansi Pembayaran”);
puts(“\t\t LOSMEN ADEM AYEM”);
puts(“\t\t*******************”);
printf(“\nNama Petugas : %s \tNama Customer\t: %s”,cstmr,ptgs);
printf(“\n\t\t\tTanggal Check in: %s”,tgl);
puts(“\n\n**************************************************”);
printf(“\nKamar yang disewakan \t: %s”,kamar);
printf(“\nHarga sewa permalam \t: %d”,hrg);
printf(“\nLama sewa \t\t: %d hari”,lama);
printf(“\nPPN \t\t\t: %10.2f”,dskn);
printf(“\nJumlah bayar \t\t: %ld”,jmlh);
printf(“\nTotal bayar\t\t: %10.2f”,tot);
printf(“\nUang bayar \t\t: “);scanf(“%f”,&byr);
kembali=byr-tot;
puts(“________________________________________-“);
printf(“\nUang Kembali \t\t: %10.2f”,kembali);
puts(“\n\n*************************************************”);
printf(“\nUlang Lagi [Y/T]? “);scanf(“%s”,&ulg);
if(ulg==’Y’||ulg==’y’)
{
clrscr();
goto start;
}
else
{
}
}

https://www.facebook.com

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: