You are on page 1of 9

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <conio.h>
#include <fstream>
#include <Windows.h>
#include <ctime>
using namespace std;

char awal, admin1, admin2, stok1, yt, yt1, yt2, yt3, yt4, yt5, kode[50];
int start, jmlBeli, totalharga, totalbayar, hargaSatuan, uangbayar, kembalian,
jenis;
string barang[6] = { "VIP", "PLATINUM", "CAT1", "CAT2", "CAT3", "CAT4" };
string nama;
int jumlah[6] = { 20 , 20, 20, 20, 20, 20 };
int jam, detik, menit, hari, bulan, tahun;
int hargatiket[6] = { 100,100,100,100,100,100 };
int mige = 0;
int hargasatuout[100];
int bayarout[100];
int kembalianout[100];
int jmlbeliout[100];
int totalout[100];
string outbarang[100];

void stok()
{
lagi:
system("cls");
char jawab;
int stokbaru, kode;
cout << " ============================================= " << endl;
cout << " STOK tiket mana yang ingin anda ubah? " << endl;
cout << " ============================================= " << endl;
cout << " 1) VIP " << endl;
cout << " 2) PLATINUM " << endl;
cout << " 3) CAT 1 " << endl;
cout << " 4) CAT 2 " << endl;
cout << " 5) CAT 3 " << endl;
cout << " 6) CAT 4 " << endl;
cout << " ============================================= " << endl;
cout << " Input [1-6] = "; cin >> kode;
cout << " Jumlah stok yang baru\t= "; cin >> stokbaru;
jumlah[kode - 1] = stokbaru;
cout << endl;
cout << " UPDATED!!" << endl;
cout << " ============================================== " << endl;
}

void harga()
{
system("cls");
char jawab;
int hargabaru, kode;
cout << " ============================================= " << endl;
cout << " HARGA tiket mana yang ingin anda ubah? " << endl;
cout << " ============================================= " << endl;
cout << " 1) VIP " << endl;
cout << " 2) PLATINUM " << endl;
cout << " 3) CAT 1 " << endl;
cout << " 4) CAT 2 " << endl;
cout << " 5) CAT 3 " << endl;
cout << " 6) CAT 4 " << endl;
cout << " ============================================= " << endl;
cout << " Input (1-6) = "; cin >> kode;
cout << " Harga tiket yang baru\t= "; cin >> hargabaru;
hargatiket[kode - 1] = hargabaru; //di min 1 karena kode itu mulai array[0]
disitu kan vipnya 1
cout << endl;
cout << " UPDATED!!" << endl;
cout << " ============================================== " << endl;
}
void waktu()
{
time_t ttime = time(0);
tm* local_time = localtime(&ttime);

jam = local_time->tm_hour;
menit = local_time->tm_min;
detik = local_time->tm_sec;
hari = local_time->tm_mday;
bulan = 1 + local_time->tm_mon;
tahun = 1900 + local_time->tm_year;
}
void customer()
{
mulai:
system("cls");
system(" color 0D ");
cout << " >>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<< " << endl;
cout << " > 2023 WORLD TOUR < " << endl;
cout << " > = BLACKPINK = < " << endl;
cout << " > in your area < " << endl;
cout << " >>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<< " << endl;

mulai1:
cout << " Nama Pembeli : ";
cin >> nama;

mulai2:
cout << " Nomor HP : ";
cin >> kode;

mulai3:
system("cls");
cout << " -------------- Jenis Tier ----------- " << endl;
cout << " 1. VIP : Rp. " << hargatiket[0] << " Sisa tiket = " <<
jumlah[0] << endl;
cout << " 2. Platinum : Rp. " << hargatiket[1] << " Sisa tiket = " <<
jumlah[1] << endl;
cout << " 3. Cat 1 : Rp. " << hargatiket[2] << " Sisa tiket = " <<
jumlah[2] << endl;
cout << " 4. Cat 2 : Rp. " << hargatiket[3] << " Sisa tiket = " <<
jumlah[3] << endl;
cout << " 5. Cat 3 : Rp. " << hargatiket[4] << " Sisa tiket = " <<
jumlah[4] << endl;
cout << " 6. Cat 4 : Rp. " << hargatiket[5] << " Sisa tiket = " <<
jumlah[5] << endl;
cout << " ------------------------------------- " << endl;
cout << " Pilih Jenis Tier [1-6] : ";
cin >> jenis;
cout << " ------------------------------------- " << endl;
cout << endl;
cout << " Anda sudah yakin dengan Tier ini? [Y/T]";
cin >> yt2;

if (yt2 == 'Y')
{
goto mulai4;
}
if (yt2 == 'T')
{
goto mulai3;
}

mulai4:
cout << " Masukan Jumlah Pembelian : ";
cin >> jmlBeli;
cout << " ------------------------------------- " << endl;
if (jmlBeli > jumlah[jenis - 1]) {
char jenisti;
cout << " MAAF STOK TIDAK MENCUKUPI " << endl;
cout << " ------------------------------------- " << endl;
cout << " Apakah anda ingin memilih Jenis tiket lain? (Y/N) ";
cin >> jenisti;
if (jenisti == 'Y')
{
goto mulai3;
}
if (jenisti == 'N')
{
goto mulai4;
}
}
else
{
jumlah[jenis - 1] = jumlah[jenis - 1] - jmlBeli;
goto lanjut;
}
lanjut:
cout << endl;
system("cls");
cout << " ======================================== " << endl;
cout << " Nota Pembayaran Tiket Konser " << endl;
cout << " 2023 World Tour Of BLACKPINK " << endl;
cout << " ======================================== " << endl;

cout << " Nama Pembeli : " << nama << endl;
if (jenis == 1)
{
hargaSatuan = hargatiket[0];
}
else if (jenis == 2)
{
hargaSatuan = hargatiket[1];
}
else if (jenis == 3)
{
hargaSatuan = hargatiket[2];
}
else if (jenis == 4)
{
hargaSatuan = hargatiket[3];
}
else if (jenis == 5)
{
hargaSatuan = hargatiket[4];
}
else if (jenis == 6)
{
hargaSatuan = hargatiket[5];
}
else
{
cout << " Maaf, kode yang anda masukkan salah " << endl << endl;
cout << " Lakukan input ulang [y/t] ";
cin >> yt3;
if (yt3 == 'Y' || yt3 == 'y')
{
goto mulai1;
}
if (yt3 == 'T' || yt3 == 't')
{
goto akhir;
}
}
cout << " Jenis tiket musik : " << barang[jenis - 1] << endl;
cout << " Harga Satuan : " << hargaSatuan << endl;
cout << " Jumlah Pembelian : " << jmlBeli << endl;
//SINI WOI
outbarang[mige] = barang[jenis - 1];
hargasatuout[mige] = hargaSatuan;
jmlbeliout[mige] = jmlBeli;
//ATAS INI LOH
cout << " ---------------------------------------- " << endl;
totalharga = hargaSatuan * jmlBeli;
totalout[mige] = totalharga;
cout << " Total Bayar : Rp. " << totalharga << endl;
ub:
cout << " Uang Bayar : Rp. ";
cin >> uangbayar;
bayarout[mige] = uangbayar;
if (uangbayar < totalharga)
{
cout << endl;
cout << " Masukkan jumlah uang yang cukup!! " << endl;
goto ub;
}
else
{
goto kembaliann;
}
kembaliann:
kembalian = uangbayar - totalharga;
kembalianout[mige] = kembalian;
cout << " Kembalian : Rp. " << kembalian << endl << endl;
cout << " Mau beli lagi? [Y/T] ";
cin >> yt;
cout << endl;
if (yt == 'Y')
{
mige = mige + 1;
goto mulai3;

}
if (yt == 'T')
{
cout << " Mau print nota? [Y/T]";
cin >> yt5;
if (yt5 == 'Y')
{
for (int x = 0; x <= mige; x++) {
waktu();
ofstream myFile;
myFile.open("StrukPembayaran.txt", ios::app);
myFile << "========================================= " <<
endl;
myFile << " Nota Pembayaran Tiket Konser " <<
endl;
myFile << " 2023 World Tour Of BLACKPINK " <<
endl;
myFile << "========================================= " <<
endl;
myFile << jam << " : " << menit << " : " << detik << endl;
myFile << hari << " - " << bulan << " - " << tahun << endl;
myFile << "Nama Pembeli : " << nama << endl;
myFile << "No. HP : " << kode << endl;
myFile << "----------------------------------------- " <<
endl;
myFile << "Jenis tiket musik : " << outbarang[x] << endl;
myFile << "Harga Satuan : Rp " << hargasatuout[x] <<
endl;
myFile << "Jumlah Pembelian : Rp " << jmlbeliout[x] <<
endl;
myFile << "----------------------------------------- " <<
endl << endl;
myFile << " Total : Rp " << totalout[x]
<< endl;
myFile << " Tunai : Rp " << bayarout[x]
<< endl;
myFile << "----------------------------------------- " <<
endl;
myFile << " Kembali : Rp " <<
kembalianout[x] << endl;
myFile << "----------------------------------------- " <<
endl;
myFile << "========================================= " <<
endl;
myFile << " Terimakasih telah membeli tiket " <<
endl;
myFile << " SEE U ON THE NEXT TOUR! " <<
endl;
myFile << " BLINK " <<
endl;
myFile << "========================================= " <<
endl;
myFile.close();
}
goto akhir;
}
goto akhir;
}

akhir:
cout << " ========================================= " << endl;
cout << " Terimakasih telah membeli tiket " << endl;
cout << " ========================================= " << endl;

void awalan()
{

mulai:
//mige = 0;
system("cls");
cout << " ============================================= " << endl;
cout << " Anda ingin masuk sebagai . . . " << endl;
cout << " ============================================= " << endl;
cout << " 1) Admin (A) " << endl;
cout << " 2) Customer (C) " << endl;
cout << " ============================================= " << endl;
cout << " Input = ";
cin >> awal;
if (awal == 'A')
{

string pass;
string benar = "150303";
char ch;
passw:
cout << " Silahkan Masukan PassWord (6 num) = ";
ch = _getch();
while (ch != 13) { // 13 adalah kode ASCII untuk karakter Enter
pass.push_back(ch); // Menambahkan karakter null pada akhir
password
cout << '*';
ch = _getch();
}
if (pass == benar)
{
system("cls");
system("color E5");
char p;
if (start == 0)
{
cout << " =========================================== " <<
endl;
cout << " Selamat datang ADMIN ! " << endl;
cout << " Silahkan INPUT data terlebih dahulu !! " << endl;
cout << " =========================================== " <<
endl;
for (int x = 0; x < 6; x++)
{
cout << " Jumlah dari tiket " << barang[x] << " = ";
cin >> jumlah[x];
cout << " Harga dari tiket " << barang[x] << " = RP
";
cin >> hargatiket[x];
}
start = 1;
}

if (start == 1)
{
mulai1:
system("cls");
cout << " ============================================= "
<< endl;
cout << " Halo ADMIN, apa yang ingin anda lakukan? " <<
endl;
cout << " ============================================= "
<< endl;
cout << " 1) MELIHAT Stok tiket dan Harga tiket " << endl;
cout << " 2) MENGUBAH Stok atau Harga tiket " << endl;
cout << " 3) KEMBALI " << endl;
cout << " ============================================= "
<< endl;
cout << " Input (1-3) = ";
cin >> admin1;
if (admin1 == '1')
{
system("cls");
cout << "
===================================================== " << endl;
cout << " JENIS\tJUMLAH HARGA" << endl;
cout << "
===================================================== " << endl;
for (int x = 0; x < 6; x++)
{
cout << " " << (x + 1) << ". " << barang[x] <<
" \t " << jumlah[x] << " \t RP " << hargatiket[x] << endl;
}
bruh2:
cout << "
===================================================== " << endl;
cout << " Apakah anda ingin mengubah Data/ keluar?
" << endl;
cout << " Input (D/K) = ";
cin >> p;
if (p == 'D') { goto mulai1; }
else if (p == 'K') { goto mulai; }
else { goto bruh2; }

}
else if (admin1 == '2')
{
Ubah:
system("cls");
cout << "
============================================= " << endl;
cout << " Apakah anda ingin mengubah jumlah
stok/harga? " << endl;
cout << "
============================================= " << endl;
cout << " 1) STOK " << endl;
cout << " 2) HARGA TIKET " << endl;
cout << " 3) KEMBALI " << endl;
cout << "
============================================= " << endl;
cout << " Input (1-3) = ";
cin >> admin2;
if (admin2 == '1')
{
stok();
bruh:
cout << " Apakah anda ingin mengubah lagi? "
<< endl;
cout << " Input (Y/N) = ";
cin >> p;
if (p == 'Y') { goto Ubah; }
else if (p == 'N') { goto mulai1; }
else { goto bruh; }

}
else if (admin2 == '2')
{
harga();
bruh1:
cout << " Apakah anda ingin mengubah lagi? "
<< endl;
cout << " Input (Y/N) = ";
cin >> p;
if (p == 'Y') { goto Ubah; }
else if (p == 'N') { goto mulai1; }
else { goto bruh1; }
}
else if (admin2 == '3')
{
goto mulai1;
}
else
{
cout << " PERIKSA KEMBALI INPUT ANDA!! " <<
endl;
goto Ubah;
}
}
else if (admin1 == '3')
{
goto mulai;
}
else
{
cout << " PERIKSA KEMBALI INPUT ANDA!! " << endl;
goto mulai1;
}
}
}
else
{
cout << " Anda salah memasukkan password " << endl;
cout << " Masukkan password lagi " << endl;
goto passw;
}
}
else if (awal == 'C')
{
customer();
goto mulai;
}
else
{
cout << " PERIKSA KEMBALI INPUT ANDA!! " << endl;
goto mulai;
}
}

int main()
{
system("cls");
system("color E2");
awalan();
return 0;
}

You might also like