Judul artikel : pogram c++ memakai struct dan array
Link artikel : pogram c++ memakai struct dan array
pogram c++ memakai struct dan array
TUGAS PEMROGRAMAN C++ MEMAKAI STRUCT DAN ARRAYKetentuan Soal
- Rancangan Program Dengan Struct Dan Array
- Kode perawatan menentukan jenis perawatan dan biaya 1 :
[kode perawatan = 2.lur1 = Lulur Rempah = 25000].
[ kode perawatan = 3.spa2 = Spa2 = 55000
- .menentukan Kode Kapster dan biaya2
[kode kapster B = Borneo = 6000 ]
[kode kapster C = Casandra = 5500 ]
- Total = biaya1+ Biaya2
- Total Bayar = penjumlahan dari total
/*--------------------------------------------------*/
/*--- Nama : Sugeng Riono ---------------------*/
/*--- Kelas: 12 1 M 04 -------------------------*/
/*--- http://sgenk.blogspot.com ---------------*/
#include <conio.h>
#include <stdio.h>
#include <iostream.h>
#include <iomanip.h>
void garis()
{
cout<<"------------------------------------------------------------------------"<<endl;
}
main()
{
struct
{
long int kode1,harga1,harga2,jh;
char kode2,jns_p[20],kapster[20];
}salon[10];
int i,j,tb;
char nk[20],nc[20];
char jwb;
atas:
tb=0;
clrscr();
garis();
cout<<"\t\t\tSALON KECANTIKAN"<<endl;
cout<<"\t\t\t \"BEA WOMAN\""<<endl;
garis();
cout<<"Kasir : ";gets(nk);
cout<<"Customer : ";gets(nc);
cout<<"Jumlah perawatan : ";cin>>j;
garis();
for (i=1;i<=j;i++)
{
cout<<endl;
cout<<"Input perawatan ke - " <<i<<endl;
cout<<"input kode perawatan " <<endl;
cout<<"1.BLO1 2.LUR1 3.SPA2 : ";cin>>salon[i].kode1;
if (salon[i].kode1==1)
{
strcpy(salon[i].jns_p,"BLOW PANJANG");
salon[i].harga1=10000;
}
else if (salon[i].kode1==2)
{
strcpy(salon[i].jns_p,"LULUR REMPAH");
salon[i].harga1=25000;
}
else
{
strcpy(salon[i].jns_p,"SPA ");
salon[i].harga1=55000;
}
cout<<"input kode kapster "<<endl;
cout<<"A.alfredo B.borneo C.casandra : ";cin>>salon[i].kode2;
if (salon[i].kode2=='a'||salon[i].kode2=='A')
{
strcpy(salon[i].kapster,"ALFREDO ");
salon[i].harga2=5000;
}
else if (salon[i].kode2=='b'||salon[i].kode2=='B')
{
strcpy(salon[i].kapster,"BORNEO ");
salon[i].harga2=6000;
}
else
{
strcpy(salon[i].kapster,"CASANDRA");
salon[i].harga2=5500;
}
salon[i].jh=(salon[i].harga1+salon[i].harga2);
}
clrscr();
garis();
cout<<"\t\t\tSTRUK PEMBAYARAN"<<endl;
cout<<"\t\t\t \"BEA WOMAN\""<<endl;
garis();
cout<<"Kasir : "<<nk<<endl;
cout<<"customer : "<<nc<<endl;
cout<<"Rincian Perawatan"<<endl;
garis();
cout<<"No. Jenis kapster Biaya 1 Biaya 2 Total "<<endl;
garis();
for (i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(3)<<i;
cout<<setprecision(10)<<" "<<salon[i].jns_p;
cout<<setprecision(10)<<" "<<salon[i].kapster;
cout<<setprecision(10)<<" "<<"Rp. "<<salon[i].harga1;
cout<<setprecision(10)<<" "<<"Rp. "<<salon[i].harga2;
cout<<setprecision(10)<<" "<<"Rp. "<<salon[i].jh<<endl;
tb=tb+salon[i].jh;
}
garis();
cout<<endl;
cout<<"\t\t\t\t\tTotal bayar Rp. "<<tb<<endl;
garis();
cout<<"\t\t\tTERIMAKASIH "<<endl;
cout<<endl;
garis();
cout<<endl;
cout<<"\t\t\tINPUT DATA LAGI [ Y/N ]??";cin>>jwb;
jwb==getch();
if (jwb=='y'||jwb=='Y')
goto atas;
getche();
}
Demikian catatan saya tentang pogram c++ memakai struct dan array
Catatan pogram c++ memakai struct dan array, semoga dapat memberikan manfaat.
hahahahhahaaa,,
ReplyDeletedah slesei niih tugasnya,,
tb=0. mksudnya apa?
ReplyDelete