Tampilan Input dan Outputnya adalah sebagai berikut :
Tampilan kondisi penjualan rumah sebagai berikut :
SELAMAT MENGERJAKAN YA....!!!!
neh jawabannya :
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
judul()/*>>>>>>>>>fungsi judul<<<<<<<<*/
{
cout<<" ROWANIF TOWN HOUSE "<<endl;
cout<<" Vila Bukit Asri "<<endl;
cout<<"===================="<<endl;
}
garis()/*>>>>>>>>>>>>fungsi garis<<<<<<<<<*/
{
cout<<"=============================================================================="<<endl;
}
long int baysis(long int hrg,long int um)/*>>>>>>>>>>>>>>fungsi sisa bayar<<<<<<<<<<<<*/
{
return(hrg-um);
}
main()/*>>>>>>>>>>>program utama<<<<<<<<<<*/
{
char nama[30],napem[30],more;
int j,a;
struct/*>>>>>>>>>>>>>>struktur<<<<<<<<<<<*/
{
char kode[5],code,kpr[25],rumah[10],type[10];
long int harga,tanjd,umuk,sisbay;
}
toko[10];/*>>>>>>>>>>>>>>array<<<<<<<<<<<*/
awal:
clrscr();
judul();
cout<<" Nama Salesman :";gets(nama);
cout<<" Nama Pembeli :";gets(napem);
cout<<" Jumlah jenis rumah :";cin>>j;
cout<<endl;
for(a=1;a<=j;a++)/*>>>>>>>>>>>perulangan untuk kondisi<<<<<<<<<*/
{
cout<<" Rumah ke-"<<a<<endl;
cout<<" Kode KPR [BTN/MDR/BMP] :";cin>>toko[a].kode;
cout<<" Kode Rumah [L/T/P/S/M] :";cin>>toko[a].code;
if(!strcmp(toko[a].kode,"BTN")||!strcmp(toko[a].kode,"btn"))/*>>>>>>>>>>>kondisi nested if<<<<<<<<<*/
{
strcpy(toko[a].kpr," Bank BTN ");
if(toko[a].code=='L'||toko[a].code=='l')
{
strcpy(toko[a].rumah," Lotus ");
strcpy(toko[a].type," 29/72 ");
toko[a].harga=156000000;
toko[a].tanjd=2000000;
toko[a].umuk=28500000;
}
else if(toko[a].code=='T'||toko[a].code=='t')
{
strcpy(toko[a].rumah," Teratai ");
strcpy(toko[a].type," 36/72 ");
toko[a].harga=191500000;
toko[a].tanjd=2000000;
toko[a].umuk=38300000;
}
else if(toko[a].code=='P'||toko[a].code=='p')
{
strcpy(toko[a].rumah," Padma ");
strcpy(toko[a].type," 45/90 ");
toko[a].harga=236000000;
toko[a].tanjd=2000000;
toko[a].umuk=47200000;
}
else if(toko[a].code=='S'||toko[a].code=='s')
{
strcpy(toko[a].rumah," Seroja ");
strcpy(toko[a].type," 56/105 ");
toko[a].harga=426000000;
toko[a].tanjd=2000000;
toko[a].umuk=71900000;
}
else
{
strcpy(toko[a].rumah," Mawar ");
strcpy(toko[a].type," 76/120 ");
toko[a].harga=746000000;
toko[a].tanjd=2000000;
toko[a].umuk=95100000;
}
}
else if(!strcmp(toko[a].kode,"MDR")||!strcmp(toko[a].kode,"mdr"))
{
strcpy(toko[a].kpr," Bank Mandiri ");
if(toko[a].code=='L'||toko[a].code=='l')
{
strcpy(toko[a].rumah," Lotus ");
strcpy(toko[a].type," 29/72 ");
toko[a].harga=156000000;
toko[a].tanjd=2000000;
toko[a].umuk=28500000;
}
else if(toko[a].code=='T'||toko[a].code=='t')
{
strcpy(toko[a].rumah," Teratai ");
strcpy(toko[a].type," 36/72 ");
toko[a].harga=191500000;
toko[a].tanjd=2000000;
toko[a].umuk=38300000;
}
else if(toko[a].code=='P'||toko[a].code=='p')
{
strcpy(toko[a].rumah," Padma ");
strcpy(toko[a].type," 45/90 ");
toko[a].harga=236000000;
toko[a].tanjd=2000000;
toko[a].umuk=47200000;
}
else if(toko[a].code=='S'||toko[a].code=='s')
{
strcpy(toko[a].rumah," Seroja ");
strcpy(toko[a].type," 56/105 ");
toko[a].harga=426000000;
toko[a].tanjd=2000000;
toko[a].umuk=71900000;
}
else
{
strcpy(toko[a].rumah," Mawar ");
strcpy(toko[a].type," 76/120 ");
toko[a].harga=746000000;
toko[a].tanjd=2000000;
toko[a].umuk=95100000;
}
}
else
{
strcpy(toko[a].kpr," Bank Bumiputera ");
if(toko[a].code=='L'||toko[a].code=='l')
{
strcpy(toko[a].rumah," Lotus ");
strcpy(toko[a].type," 29/72 ");
toko[a].harga=156000000;
toko[a].tanjd=2000000;
toko[a].umuk=0;
}
else if(toko[a].code=='T'||toko[a].code=='t')
{
strcpy(toko[a].rumah," Teratai ");
strcpy(toko[a].type," 36/72 ");
toko[a].harga=191500000;
toko[a].tanjd=2000000;
toko[a].umuk=0;
}
else if(toko[a].code=='P'||toko[a].code=='p')
{
strcpy(toko[a].rumah," Padma ");
strcpy(toko[a].type," 45/90 ");
toko[a].harga=236000000;
toko[a].tanjd=2000000;
toko[a].umuk=0;
}
else if(toko[a].code=='S'||toko[a].code=='s')
{
strcpy(toko[a].rumah," Seroja ");
strcpy(toko[a].type," 56/105 ");
toko[a].harga=426000000;
toko[a].tanjd=2000000;
toko[a].umuk=0;
}
else
{
strcpy(toko[a].rumah," Mawar ");
strcpy(toko[a].type," 76/120 ");
toko[a].harga=746000000;
toko[a].tanjd=2000000;
toko[a].umuk=0;
}
}
cout<<endl;
}
cout<<endl<<endl;
clrscr();
judul();
cout<<" Nama Salesman :"<<nama<<endl;
cout<<" Nama Pembeli :"<<napem<<endl;
cout<<endl;
garis();
cout<<"No. Nama KPR Jenis Type Harga Tanda Uang Sisa "<<endl;
cout<<" Rumah Rumah Jadi Muka Bayar "<<endl;
garis();
for(a=1;a<=j;a++)/*>>>>>>>>perulangan untuk mencetak output<<<<<<<<<*/
{
cout<<setiosflags(ios::left)<<setw(4)<<a;
cout<<setiosflags(ios::left)<<setw(17)<<toko[a].kpr;
cout<<setiosflags(ios::left)<<setw(9)<<toko[a].rumah;
cout<<setiosflags(ios::left)<<setw(8)<<toko[a].type;
cout<<setiosflags(ios::right)<<setw(11)<<toko[a].harga;
cout<<setiosflags(ios::right)<<setw(9)<<toko[a].tanjd;
cout<<setiosflags(ios::right)<<setw(10)<<toko[a].umuk;
toko[a].sisbay=baysis(toko[a].harga,toko[a].umuk);
cout<<setiosflags(ios::right)<<setw(10)<<toko[a].sisbay<<endl;
}
garis();
cout<<endl<<endl;
cout<<" note : "<<endl;
cout<<" ~Uang Muka bisa diangsur 3x (kali) selama 3 bulan "<<endl;
cout<<"\t\t\tInput Data Lagi [Y/T]: ";cin>>more;/*>>>>>>>penggunaan label<<<<<<<*/
if(more=='Y'||more=='y')
goto awal;
else
clrscr();
cout<<"\t\t\t\3\3 TERIMA KASIH \3\3 "<<endl;
getch();
}
SEMOGA BERMANFAAT....
izin copas gan "maksaih
ReplyDeleteyah tak bisa di copas
ReplyDeletecara menggabungkan tipe data struct bagaimana gan?
ReplyDelete