#include"stdio.h"
#include"conio.h"
#include"iostream.h"
#include"iomanip.h"
judul()
{
cout<<"\t\t\tPENYEWAAN PAKAIAN ADAT NASIONAL"<<endl;
cout<<"\t\t\t CHONIO BOUTIQUE "<<endl;
cout<<"\t\t\t*******************************"<<endl;
}
garis()
{
cout<<"*****************************************************************"<<endl;
}
long int ttl(int jml,int hrg)
{
return(jml*hrg);
}
main()
{
char nama[30],more,lama;
long total;
long ub,uk;
int a,s;
struct
{
char kode_baju[5],kode_uku,nama_paket[30];
int jumlah;
long harga,subtotal;
}baju[15];
awal:
clrscr();
total=0;
judul();
cout<<"NAMA PENYEWA : ";gets(nama);
cout<<"INPUT LAMA SEWA : ";cin>>lama;
cout<<"INPUT JUMLAH DATA : ";cin>>s;
cout<<endl;
for(a=1;a<=s;a++)
{
cout<<"DATA KE-"<<a<<endl;
cout<<"INPUT KODE PAKET BAJU [JB/JT/SB] : ";cin>>baju[a].kode_baju;
cout<<"INPUT KODE UKURAN BAJU [S/M/L] : ";cin>>baju[a].kode_uku;
cout<<"JUMLAH SEWA : ";cin>>baju[a].jumlah;
if(!strcmp(baju[a].kode_baju,"JB")||!strcmp(baju[a].kode_baju,"jb"))
{
strcpy(baju[a].nama_paket,"JAWA BARAT");
if(baju[a].kode_uku=='S'||baju[a].kode_uku=='s')
{baju[a].harga=200000;}
else if(baju[a].kode_uku=='M'||baju[a].kode_uku=='m')
{baju[a].harga=230000;}
else if(baju[a].kode_uku=='L'||baju[a].kode_uku=='l')
{baju[a].harga=250000;}
}
else if(!strcmp(baju[a].kode_baju,"JT")||!strcmp(baju[a].kode_baju,"jt"))
{
strcpy(baju[a].nama_paket,"JAWA TENGAH");
if(baju[a].kode_uku=='S'||baju[a].kode_uku=='s')
{baju[a].harga=230000;}
else if(baju[a].kode_uku=='M'||baju[a].kode_uku=='m')
{baju[a].harga=255000;}
else if(baju[a].kode_uku=='L'||baju[a].kode_uku=='l')
{baju[a].harga=270000;}
}
else if(strcmp(baju[a].kode_baju,"SB")||strcmp(baju[a].kode_baju,"sb"))
{
strcpy(baju[a].nama_paket,"SUMATERA BARAT");
if(baju[a].kode_uku=='S'||baju[a].kode_uku=='s')
{baju[a].harga=240000;}
else if(baju[a].kode_uku=='M'||baju[a].kode_uku=='m')
{baju[a].harga=265000;}
else if(baju[a].kode_uku=='L'||baju[a].kode_uku=='l')
{baju[a].harga=300000;}
}
cout<<endl;
}
cout<<endl<<endl;
clrscr();
judul();
cout<<"\nNAMA PENYEWA : ";cout<<nama<<endl;
cout<<"DATA BAJU YANG DISEWA"<<endl;
garis();
cout<<"No. Nama Paket Harga Jumlah Sewa Subtotal"<<endl;
garis();
for(a=1;a<=s;a++)
{
gotoxy(2,wherey());cout<<a<<".";
gotoxy(8,wherey());cout<<baju[a].nama_paket;
gotoxy(27,wherey());cout<<baju[a].harga;
gotoxy(45,wherey());cout<<baju[a].jumlah;
baju[a].subtotal=ttl(baju[a].jumlah,baju[a].harga);
gotoxy(58,wherey());cout<<baju[a].subtotal<<endl;
total=total+baju[a].subtotal;
}
garis();
cout<<"\t\t\t\tTotal Bayar : ";
gotoxy(55,wherey());cout<<"Rp "<<total<<endl;
cout<<"\t\t\t\tUang Bayar : ";
gotoxy(55,wherey());cout<<"Rp ";cin>>ub;
uk=ub-total;
cout<<"\t\t\t\tUang Kembali : ";
gotoxy(55,wherey());cout<<"Rp "<<uk;
cout<<endl;
gotoxy(15,wherey());cout<<"TERIMA KASIH"<<endl;
cout<<"INPUT DATA LAGI [Y/T] : ";cin>>more;
if(more=='Y'||more=='y')
goto awal;
else
goto akhir;
getch();
akhir:
}
Hasil running seperti gambar diatas
#include"conio.h"
#include"iostream.h"
#include"iomanip.h"
judul()
{
cout<<"\t\t\tPENYEWAAN PAKAIAN ADAT NASIONAL"<<endl;
cout<<"\t\t\t CHONIO BOUTIQUE "<<endl;
cout<<"\t\t\t*******************************"<<endl;
}
garis()
{
cout<<"*****************************************************************"<<endl;
}
long int ttl(int jml,int hrg)
{
return(jml*hrg);
}
main()
{
char nama[30],more,lama;
long total;
long ub,uk;
int a,s;
struct
{
char kode_baju[5],kode_uku,nama_paket[30];
int jumlah;
long harga,subtotal;
}baju[15];
awal:
clrscr();
total=0;
judul();
cout<<"NAMA PENYEWA : ";gets(nama);
cout<<"INPUT LAMA SEWA : ";cin>>lama;
cout<<"INPUT JUMLAH DATA : ";cin>>s;
cout<<endl;
for(a=1;a<=s;a++)
{
cout<<"DATA KE-"<<a<<endl;
cout<<"INPUT KODE PAKET BAJU [JB/JT/SB] : ";cin>>baju[a].kode_baju;
cout<<"INPUT KODE UKURAN BAJU [S/M/L] : ";cin>>baju[a].kode_uku;
cout<<"JUMLAH SEWA : ";cin>>baju[a].jumlah;
if(!strcmp(baju[a].kode_baju,"JB")||!strcmp(baju[a].kode_baju,"jb"))
{
strcpy(baju[a].nama_paket,"JAWA BARAT");
if(baju[a].kode_uku=='S'||baju[a].kode_uku=='s')
{baju[a].harga=200000;}
else if(baju[a].kode_uku=='M'||baju[a].kode_uku=='m')
{baju[a].harga=230000;}
else if(baju[a].kode_uku=='L'||baju[a].kode_uku=='l')
{baju[a].harga=250000;}
}
else if(!strcmp(baju[a].kode_baju,"JT")||!strcmp(baju[a].kode_baju,"jt"))
{
strcpy(baju[a].nama_paket,"JAWA TENGAH");
if(baju[a].kode_uku=='S'||baju[a].kode_uku=='s')
{baju[a].harga=230000;}
else if(baju[a].kode_uku=='M'||baju[a].kode_uku=='m')
{baju[a].harga=255000;}
else if(baju[a].kode_uku=='L'||baju[a].kode_uku=='l')
{baju[a].harga=270000;}
}
else if(strcmp(baju[a].kode_baju,"SB")||strcmp(baju[a].kode_baju,"sb"))
{
strcpy(baju[a].nama_paket,"SUMATERA BARAT");
if(baju[a].kode_uku=='S'||baju[a].kode_uku=='s')
{baju[a].harga=240000;}
else if(baju[a].kode_uku=='M'||baju[a].kode_uku=='m')
{baju[a].harga=265000;}
else if(baju[a].kode_uku=='L'||baju[a].kode_uku=='l')
{baju[a].harga=300000;}
}
cout<<endl;
}
cout<<endl<<endl;
clrscr();
judul();
cout<<"\nNAMA PENYEWA : ";cout<<nama<<endl;
cout<<"DATA BAJU YANG DISEWA"<<endl;
garis();
cout<<"No. Nama Paket Harga Jumlah Sewa Subtotal"<<endl;
garis();
for(a=1;a<=s;a++)
{
gotoxy(2,wherey());cout<<a<<".";
gotoxy(8,wherey());cout<<baju[a].nama_paket;
gotoxy(27,wherey());cout<<baju[a].harga;
gotoxy(45,wherey());cout<<baju[a].jumlah;
baju[a].subtotal=ttl(baju[a].jumlah,baju[a].harga);
gotoxy(58,wherey());cout<<baju[a].subtotal<<endl;
total=total+baju[a].subtotal;
}
garis();
cout<<"\t\t\t\tTotal Bayar : ";
gotoxy(55,wherey());cout<<"Rp "<<total<<endl;
cout<<"\t\t\t\tUang Bayar : ";
gotoxy(55,wherey());cout<<"Rp ";cin>>ub;
uk=ub-total;
cout<<"\t\t\t\tUang Kembali : ";
gotoxy(55,wherey());cout<<"Rp "<<uk;
cout<<endl;
gotoxy(15,wherey());cout<<"TERIMA KASIH"<<endl;
cout<<"INPUT DATA LAGI [Y/T] : ";cin>>more;
if(more=='Y'||more=='y')
goto awal;
else
goto akhir;
getch();
akhir:
}
Hasil running seperti gambar diatas