#include <stdio.h>
#include <conio.h>
#include <iostream.h>
main()
{
char nama[15],barang[15];
int kode,harga,jumbel,total;
clrscr();
puts("-------------------------------------");
puts(" TOKO BAJU ");
puts("-------------------------------------");
puts(" KODE BARANG ");
puts("-------------------------------------");
puts("1. Kain Sutra RP.100000 ");
puts("2. Kain Katun RP.50000 ");
puts("3.Kain Kombed RP.40000 ");
puts("4.Kain karded RP.20000 ");
puts("-------------------------------------");
puts("Input Nama Pembeli : ");cin>>nama;
puts("Input jenis Kain : ");cin>>kode;
cout<<"Input Jumlah Beli : ";cin>>jumbel;
switch(kode)
{
case 1:
strcpy(barang," Kain Sutra");
harga=100000;
break;
case 2:
strcpy(barang,"Kain Katun");
harga=50000;
break;
case 3:
strcpy(barang,"Kain Kombed");
harga=40000;
break;
case 4:
strcpy(barang,"Kain karded");
harga=20000;
break;
default:
strcpy(barang,"Anda Salah Kode");
harga=10;
break;
}
total=jumbel*harga;
clrscr();
cout<<"==============================="<<endl;
cout<<" STRUK PENJUALAN "<<endl;
cout<<"==============================="<<endl;
cout<<"Nama Pembeli : "<<nama<<endl;
cout<<"Nama Barang : "<<barang<<endl;
cout<<"Harga Barang : "<<harga<<endl;
cout<<"Jumlah Barang : "<<jumbel<<endl;
cout<<"Total : "<<total;
getch();
}
#include <conio.h>
#include <iostream.h>
main()
{
char nama[15],barang[15];
int kode,harga,jumbel,total;
clrscr();
puts("-------------------------------------");
puts(" TOKO BAJU ");
puts("-------------------------------------");
puts(" KODE BARANG ");
puts("-------------------------------------");
puts("1. Kain Sutra RP.100000 ");
puts("2. Kain Katun RP.50000 ");
puts("3.Kain Kombed RP.40000 ");
puts("4.Kain karded RP.20000 ");
puts("-------------------------------------");
puts("Input Nama Pembeli : ");cin>>nama;
puts("Input jenis Kain : ");cin>>kode;
cout<<"Input Jumlah Beli : ";cin>>jumbel;
switch(kode)
{
case 1:
strcpy(barang," Kain Sutra");
harga=100000;
break;
case 2:
strcpy(barang,"Kain Katun");
harga=50000;
break;
case 3:
strcpy(barang,"Kain Kombed");
harga=40000;
break;
case 4:
strcpy(barang,"Kain karded");
harga=20000;
break;
default:
strcpy(barang,"Anda Salah Kode");
harga=10;
break;
}
total=jumbel*harga;
clrscr();
cout<<"==============================="<<endl;
cout<<" STRUK PENJUALAN "<<endl;
cout<<"==============================="<<endl;
cout<<"Nama Pembeli : "<<nama<<endl;
cout<<"Nama Barang : "<<barang<<endl;
cout<<"Harga Barang : "<<harga<<endl;
cout<<"Jumlah Barang : "<<jumbel<<endl;
cout<<"Total : "<<total;
getch();
}
thanks gan
BalasHapussukses selalu ya
BalasHapus