Dalam membuat Program Toko Penjualan Baju di C++ saya sendiri menggunakan Dev C++,namun kalian juga bisa menggunakan yang lainnya seperti borland C++,dll.Mari kita langsung saja ke programnya
listing program(script) nya yang ada di bawah ini:
Tolong untuk listing program di bawah ini jangan di jadikan sebagai contekan untuk ujian,tugas,saya perbolehkan menggunakan listing di bawah ini untuk belajar dan latihan bahasa pemrograman c++
Saya sarankan lebih baik listing tersebut diketikan dari pada di copy paste supaya kalian ingat dan lebih paham.
Saya sarankan lebih baik listing tersebut diketikan dari pada di copy paste supaya kalian ingat dan lebih paham.
Kalian juga bisa mendapatkan file programnya dengan mengklik di bawah ini:
file :Google Drive
Untuk tampilan awalnya seperti ini:
A.menggunakan header stdio.h
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <windows.h>
main(){
system("color 0A");
int p,jum,z,input,choose,uangbayar,t,kurang,kembalian;
int pajak[100],jb[100],harga[100],subtot[100];
char s,paket[100],jpaket[100],u[100],nm[100];
menu :
system("cls");
printf("\t\t\tSELAMAT DATANG DI TOKO PENJUALAN BAJU\n\n");
printf("Pilihan Menu :\n");
printf("1. Tampilkan Tabel Harga\n");
printf("2. Input Data\n");
printf("3. Log Out\n");
printf("=================================\n");
printf("Inputkan Pilihan Anda : ");scanf("%d",&choose);
system("cls");
switch(choose){
case 1 :
tabel :
system("cls");
printf("Tabel Daftar Harga\n");
printf("================================\n");
printf("| KODE PAKET HARGA |\n");
printf("================================\n");
printf("| A JAWA BARAT Rp.200.000 |\n");
printf("| B JAWA TENGAH Rp.250.000 |\n");
printf("| C SUMATERA Rp.300.000 |\n");
printf("| D ACEH Rp.150.000 |\n");
printf("| E BALI Rp.400.000 |\n");
printf("================================\n");
printf("--->> Akan Di Kenakan Pajak 8% Dari Setiap Pembelian\n");
printf("TEKAN TOMBOL [M=MENU] UNTUK KEMBALI, TEKAN SEMBARANG TOMBOL UNTUK KELUAR = ");s=getche();
if(s=='M'||s=='m'){
goto menu;}
else{
goto keluar;}break;
case 2 :
ulangi :
system("cls");
printf("Input Jumlah Data = ");scanf("%d",&input);
printf("\nNama Pembeli / Konsumen = ");scanf("%s",&nm);
for(z=1;z<=input;z++)
{
printf("\nINPUT DATA KE - %d",z);
printf("\nJenis Baju / Paket [A/B/C/D/E] = ");scanf("%s",&paket[z]);
printf("Ukuran Baju [S/M/L/XL] = ");scanf("%s",&u[z]);
printf("Jumlah Beli = ");scanf("%d",&jb[z]);
printf("\n\n");
printf("===========================================================\n\n");
}break;
case 3 :
goto keluar;break;
}
system("cls");
printf("OUTPUT\n");
printf("Data Baju Yang Di Sewa\n");
printf("Nama Penyewa : %s\n",nm);
printf("======================================================================\n");
printf("NO. JENIS PAKET HARGA UKURAN BANYAK SUB TOTAL \n");
printf("======================================================================\n");
jum=0;
p=0;
for(z=1;z<=input;z++)
{
printf(" %d ",z);
switch(paket[z]){
case 'A' : case 'a' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=200000*jb[z];
pajak[z]=(200000*0.08)*jb[z];
printf("JAWA BARAT Rp.200000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=200000*jb[z];
pajak[z]=(200000*0.08)*jb[z];
printf("JAWA BARAT Rp.200000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=200000*jb[z];
pajak[z]=(200000*0.08)*jb[z];
printf("JAWA BARAT Rp.200000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=200000*jb[z];
pajak[z]=(200000*0.08)*jb[z];
printf("JAWA BARAT Rp.200000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
case 'B' : case 'b' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=250000*jb[z];
pajak[z]=(250000*0.08)*jb[z];
printf("JAWA TENGAH Rp.250000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=250000*jb[z];
pajak[z]=(250000*0.08)*jb[z];
printf("JAWA TENGAH Rp.250000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=250000*jb[z];
pajak[z]=(250000*0.08)*jb[z];
printf("JAWA TENGAH Rp.250000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=250000*jb[z];
pajak[z]=(250000*0.08)*jb[z];
printf("JAWA TENGAH Rp.250000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
case 'C' : case 'c' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=300000*jb[z];
pajak[z]=(300000*0.08)*jb[z];
printf("SUMATERA Rp.300000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=300000*jb[z];
pajak[z]=(300000*0.08)*jb[z];
printf("SUMATERA Rp.300000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=300000*jb[z];
pajak[z]=(300000*0.08)*jb[z];
printf("SUMATERA Rp.300000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=300000*jb[z];
pajak[z]=(300000*0.08)*jb[z];
printf("SUMATERA Rp.300000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
case 'D' : case 'd' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=150000*jb[z];
pajak[z]=(150000*0.08)*jb[z];
printf("ACEH Rp.150000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=150000*jb[z];
pajak[z]=(150000*0.08)*jb[z];
printf("ACEH Rp.150000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=150000*jb[z];
pajak[z]=(150000*0.08)*jb[z];
printf("ACEH Rp.150000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=150000*jb[z];
pajak[z]=(150000*0.08)*jb[z];
printf("ACEH Rp.150000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
case 'E' : case 'e' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=400000*jb[z];
pajak[z]=(400000*0.08)*jb[z];
printf("BALI Rp.400000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=400000*jb[z];
pajak[z]=(400000*0.08)*jb[z];
printf("BALI Rp.400000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=400000*jb[z];
pajak[z]=(400000*0.08)*jb[z];
printf("BALI Rp.400000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=400000*jb[z];
pajak[z]=(400000*0.08)*jb[z];
printf("BALI Rp.400000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
}
jum=jum+subtot[z];
p=p+pajak[z];
t=jum+p;
}
printf("======================================================================\n");
printf(" Jumlah Bayar = Rp. %d",jum);
printf("\n Pajak = Rp. %d",p);
printf("\n Total Bayar = Rp. %d",t);
printf("\n======================================================================\n");
printf("Input Uang Bayar = ");scanf("%d",&uangbayar);
if(uangbayar<t){
system("cls");
printf("Input Uang Bayar = %d",uangbayar);
kurang=t-uangbayar;
printf("\nKekurangannya = Rp. %d",kurang);
printf("TEKAN TOMBOL [M=MENU] UNTUK KEMBALI, TOMBOL [U=ULANGI] = ");s=getche();
if(s=='M'||'m'){goto menu;
}else if(s=='U'||'u'){goto ulangi;
}
}else{
system("cls");
kembalian=uangbayar-t;
printf("Kembaliannya : Rp. %d ",kembalian);
printf("TEKAN TOMBOL [M=MENU] UNTUK KEMBALI, TOMBOL [U=ULANGI] = ");s=getche();
if(s=='M'||'m'){goto menu;
}else if(s=='U'||'u'){goto ulangi;
}
}
keluar :
system("cls");
printf("Log Out");
getch();
}
#include <conio.h>
#include <string.h>
#include <windows.h>
main(){
system("color 0A");
int p,jum,z,input,choose,uangbayar,t,kurang,kembalian;
int pajak[100],jb[100],harga[100],subtot[100];
char s,paket[100],jpaket[100],u[100],nm[100];
menu :
system("cls");
printf("\t\t\tSELAMAT DATANG DI TOKO PENJUALAN BAJU\n\n");
printf("Pilihan Menu :\n");
printf("1. Tampilkan Tabel Harga\n");
printf("2. Input Data\n");
printf("3. Log Out\n");
printf("=================================\n");
printf("Inputkan Pilihan Anda : ");scanf("%d",&choose);
system("cls");
switch(choose){
case 1 :
tabel :
system("cls");
printf("Tabel Daftar Harga\n");
printf("================================\n");
printf("| KODE PAKET HARGA |\n");
printf("================================\n");
printf("| A JAWA BARAT Rp.200.000 |\n");
printf("| B JAWA TENGAH Rp.250.000 |\n");
printf("| C SUMATERA Rp.300.000 |\n");
printf("| D ACEH Rp.150.000 |\n");
printf("| E BALI Rp.400.000 |\n");
printf("================================\n");
printf("--->> Akan Di Kenakan Pajak 8% Dari Setiap Pembelian\n");
printf("TEKAN TOMBOL [M=MENU] UNTUK KEMBALI, TEKAN SEMBARANG TOMBOL UNTUK KELUAR = ");s=getche();
if(s=='M'||s=='m'){
goto menu;}
else{
goto keluar;}break;
case 2 :
ulangi :
system("cls");
printf("Input Jumlah Data = ");scanf("%d",&input);
printf("\nNama Pembeli / Konsumen = ");scanf("%s",&nm);
for(z=1;z<=input;z++)
{
printf("\nINPUT DATA KE - %d",z);
printf("\nJenis Baju / Paket [A/B/C/D/E] = ");scanf("%s",&paket[z]);
printf("Ukuran Baju [S/M/L/XL] = ");scanf("%s",&u[z]);
printf("Jumlah Beli = ");scanf("%d",&jb[z]);
printf("\n\n");
printf("===========================================================\n\n");
}break;
case 3 :
goto keluar;break;
}
system("cls");
printf("OUTPUT\n");
printf("Data Baju Yang Di Sewa\n");
printf("Nama Penyewa : %s\n",nm);
printf("======================================================================\n");
printf("NO. JENIS PAKET HARGA UKURAN BANYAK SUB TOTAL \n");
printf("======================================================================\n");
jum=0;
p=0;
for(z=1;z<=input;z++)
{
printf(" %d ",z);
switch(paket[z]){
case 'A' : case 'a' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=200000*jb[z];
pajak[z]=(200000*0.08)*jb[z];
printf("JAWA BARAT Rp.200000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=200000*jb[z];
pajak[z]=(200000*0.08)*jb[z];
printf("JAWA BARAT Rp.200000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=200000*jb[z];
pajak[z]=(200000*0.08)*jb[z];
printf("JAWA BARAT Rp.200000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=200000*jb[z];
pajak[z]=(200000*0.08)*jb[z];
printf("JAWA BARAT Rp.200000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
case 'B' : case 'b' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=250000*jb[z];
pajak[z]=(250000*0.08)*jb[z];
printf("JAWA TENGAH Rp.250000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=250000*jb[z];
pajak[z]=(250000*0.08)*jb[z];
printf("JAWA TENGAH Rp.250000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=250000*jb[z];
pajak[z]=(250000*0.08)*jb[z];
printf("JAWA TENGAH Rp.250000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=250000*jb[z];
pajak[z]=(250000*0.08)*jb[z];
printf("JAWA TENGAH Rp.250000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
case 'C' : case 'c' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=300000*jb[z];
pajak[z]=(300000*0.08)*jb[z];
printf("SUMATERA Rp.300000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=300000*jb[z];
pajak[z]=(300000*0.08)*jb[z];
printf("SUMATERA Rp.300000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=300000*jb[z];
pajak[z]=(300000*0.08)*jb[z];
printf("SUMATERA Rp.300000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=300000*jb[z];
pajak[z]=(300000*0.08)*jb[z];
printf("SUMATERA Rp.300000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
case 'D' : case 'd' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=150000*jb[z];
pajak[z]=(150000*0.08)*jb[z];
printf("ACEH Rp.150000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=150000*jb[z];
pajak[z]=(150000*0.08)*jb[z];
printf("ACEH Rp.150000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=150000*jb[z];
pajak[z]=(150000*0.08)*jb[z];
printf("ACEH Rp.150000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=150000*jb[z];
pajak[z]=(150000*0.08)*jb[z];
printf("ACEH Rp.150000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
case 'E' : case 'e' :
if (u[z]=='S' || u[z]=='s'){
subtot[z]=400000*jb[z];
pajak[z]=(400000*0.08)*jb[z];
printf("BALI Rp.400000 S %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='M' || u[z]=='m'){
subtot[z]=400000*jb[z];
pajak[z]=(400000*0.08)*jb[z];
printf("BALI Rp.400000 M %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='L' || u[z]=='l'){
subtot[z]=400000*jb[z];
pajak[z]=(400000*0.08)*jb[z];
printf("BALI Rp.400000 L %d\t %d\n",jb[z],subtot[z]);break;
}
if (u[z]=='X' || u[z]=='x'){
subtot[z]=400000*jb[z];
pajak[z]=(400000*0.08)*jb[z];
printf("BALI Rp.400000 XL %d\t %d\n",jb[z],subtot[z]);break;
}
}
jum=jum+subtot[z];
p=p+pajak[z];
t=jum+p;
}
printf("======================================================================\n");
printf(" Jumlah Bayar = Rp. %d",jum);
printf("\n Pajak = Rp. %d",p);
printf("\n Total Bayar = Rp. %d",t);
printf("\n======================================================================\n");
printf("Input Uang Bayar = ");scanf("%d",&uangbayar);
if(uangbayar<t){
system("cls");
printf("Input Uang Bayar = %d",uangbayar);
kurang=t-uangbayar;
printf("\nKekurangannya = Rp. %d",kurang);
printf("TEKAN TOMBOL [M=MENU] UNTUK KEMBALI, TOMBOL [U=ULANGI] = ");s=getche();
if(s=='M'||'m'){goto menu;
}else if(s=='U'||'u'){goto ulangi;
}
}else{
system("cls");
kembalian=uangbayar-t;
printf("Kembaliannya : Rp. %d ",kembalian);
printf("TEKAN TOMBOL [M=MENU] UNTUK KEMBALI, TOMBOL [U=ULANGI] = ");s=getche();
if(s=='M'||'m'){goto menu;
}else if(s=='U'||'u'){goto ulangi;
}
}
keluar :
system("cls");
printf("Log Out");
getch();
}
Untuk materi lain kalian bisa mengklik gambarnya di bawah ini:
Cukup sekian untuk pembahasan kali ini,silahkan jika ingin berkomentar atau memberikan saran,mohon maaf apabila ada kesalahan semoga pembahasan ini dapat bermanfaat.Jika artikel di atas terdapat kekeliruan atau kesalahan,mohon untuk hubungi saya melalui contact atau melalui komentar.
EmoticonEmoticon