Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <conio.h>
- #include <windows.h>
- using namespace std;
- int no,urutbrg,diskon;
- bool admin;
- struct pembelian{
- int jumlah[100];
- int banyak[100];
- int hrgbrg[100];
- string nmbrg[100];
- };
- pembelian beli;
- struct urut{
- string nmbrg[100];
- int hrgbrg[100];
- int banyak[100];
- int jumlah[100];
- };
- urut ngurut[100];
- int pengurut[100];
- struct persediaan{
- int wardah;
- int cnc;
- int garnier;
- int soffel;
- int hic;
- };
- persediaan stok;
- int total[100],ttl;
- char lagi;
- void gotoxy(int x,int y){
- COORD k = {x,y};
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), k);
- }
- void login(){
- string user,passwd,inuser,inpasswd;
- char input;
- user="keluargacemana";passwd="admin123";
- char adm;
- anjay:
- system("color 0b");
- system("cls");
- gotoxy(42,3);cout << "=====================================";
- gotoxy(42,4);cout << "[ LOGIN APLIKASI ]";
- gotoxy(42,5);cout << "=====================================";
- gotoxy(42,7);cout << "APAKAH ANDA SEORANG ADMIN? (y/t): ";cin>>adm;
- if (adm=='y'){
- gotoxy(42,7);cout << " ";
- gotoxy(42,7);cout<< "MASUKKAN USERNAME: ";
- gotoxy(42,8);cout<< "MASUKKAN PASSWORD: ";
- int p=1;
- int a=1;
- gotoxy(61,7);cin>> inuser;
- gotoxy(61,8);cin>> inpasswd;
- if (inuser==user){
- if(inpasswd==passwd){
- admin=1;
- system("cls");
- gotoxy(46,13);cout<< "============================";
- gotoxy(46,14);cout<< "[ ANDA LOGIN SEBAGAI ADMIN ]";
- gotoxy(46,15);cout<< "============================";
- getch();
- }else{
- system("cls");
- gotoxy(50,13);cout<< "====================";
- gotoxy(50,14);cout<< "[ PASSWORD SALAH!! ]";
- gotoxy(50,15);cout<< "====================";
- getch();
- goto anjay;
- }
- }else{
- system("cls");
- gotoxy(50,13);cout<< "====================";
- gotoxy(50,14);cout<< "[ USERNAME SALAH!! ]";
- gotoxy(50,15);cout<< "====================";
- getch();
- goto anjay;
- }
- }
- }
- void BeliProduk(){
- char pilihproduk,lg;
- urutbrg=1;
- atas:
- system("color 0A");
- pengurut[no]=urutbrg;
- system("cls");
- gotoxy(10,1);cout<<"Nomor Struk = "<<no;
- gotoxy(39,1);cout<<"barang ke-"<<urutbrg;
- gotoxy(39,2);cout<<"=======================================";
- gotoxy(39,3);cout<<"==Silahkan Pilih Produk Yang Diminati==";
- gotoxy(39,4);cout<<"=======================================";
- gotoxy(39,5);cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
- gotoxy(39,6);cout<<"=1. Wardah gentle wash 50 ml (19k)=====";
- gotoxy(39,7);cout<<"=2. Clean n clear oil control (35k)====";
- gotoxy(39,8);cout<<"=3. Garnier micellar cleansing water for oily (35k)";
- gotoxy(39,9);cout<<"=4. Soffell pink 80g (15k)=============";
- gotoxy(39,10);cout<<"=5. Hot in cream 120 ml (16k)==========";
- gotoxy(39,11);cout<<"=6. Kembali ke Menu Awal===============";
- gotoxy(39,12);cout<<"=======================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- gotoxy(40,13);cout<<"Masukkan Pilihan Anda : ";
- gotoxy(40,14);cout<<"Masukkan Jumlah Yang Anda Inginkan: ";
- gotoxy(70,20);cout<<"Jumlah Yang Harus Dibayar: Rp."<<beli.jumlah[no];
- gotoxy(64,13);cin>>pilihproduk;
- switch (pilihproduk) {
- case '1':
- beli.nmbrg[urutbrg]="Wardah gentle wash 50 ml";
- beli.hrgbrg[urutbrg]=19000;
- if (stok.wardah>0){
- gotoxy(76,14);cin>>beli.banyak[urutbrg];
- if (beli.banyak[urutbrg]>stok.wardah){
- system("color 0C");
- system("cls");
- gotoxy(35,10);cout<< "==================================================";
- gotoxy(35,11);cout<< "MAAF STOK BARANG YANG ANDA MASUKKAN TERLALU BANYAK";
- gotoxy(35,12);cout<< "==================================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- stok.wardah=stok.wardah-beli.banyak[urutbrg];
- }
- else{
- system("color 0C");
- system("cls");
- gotoxy(38,10);cout<< "============================================";
- gotoxy(38,11);cout<< "MAAF STOK BARANG YANG ANDA PILIH SUDAH HABIS";
- gotoxy(38,12);cout<< "============================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- break;
- case '2':
- beli.nmbrg[urutbrg]="Clean n clear oil control";
- beli.hrgbrg[urutbrg]=35000;
- if (stok.cnc>0){
- gotoxy(76,14);cin>>beli.banyak[urutbrg];
- if (beli.banyak[urutbrg]>stok.cnc){
- system("color 0C");
- system("cls");
- gotoxy(35,10);cout<< "==================================================";
- gotoxy(35,11);cout<< "MAAF STOK BARANG YANG ANDA MASUKKAN TERLALU BANYAK";
- gotoxy(35,12);cout<< "==================================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- stok.cnc=stok.cnc-beli.banyak[urutbrg];
- }
- else{
- system("color 0C");
- system("cls");
- gotoxy(38,10);cout<< "============================================";
- gotoxy(38,11);cout<< "MAAF STOK BARANG YANG ANDA PILIH SUDAH HABIS";
- gotoxy(38,12);cout<< "============================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- break;
- case '3':
- beli.nmbrg[urutbrg]="Garnier micellar cleansing water for oily";
- beli.hrgbrg[urutbrg]=35000;
- if (stok.garnier>0){
- gotoxy(76,14);cin>>beli.banyak[urutbrg];
- if (beli.banyak[urutbrg]>stok.garnier){
- system("color 0C");
- system("cls");
- gotoxy(35,10);cout<< "==================================================";
- gotoxy(35,11);cout<< "MAAF STOK BARANG YANG ANDA MASUKKAN TERLALU BANYAK";
- gotoxy(35,12);cout<< "==================================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- stok.garnier=stok.garnier-beli.banyak[urutbrg];
- }
- else{
- system("color 0C");
- system("cls");
- gotoxy(38,10);cout<< "============================================";
- gotoxy(38,11);cout<< "MAAF STOK BARANG YANG ANDA PILIH SUDAH HABIS";
- gotoxy(38,12);cout<< "============================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- break;
- case '4':
- beli.nmbrg[urutbrg]="Soffell pink 80g";
- beli.hrgbrg[urutbrg]=15000;
- if (stok.soffel>0){
- gotoxy(76,14);cin>>beli.banyak[urutbrg];
- if (beli.banyak[urutbrg]>stok.soffel){
- system("color 0C");
- system("cls");
- gotoxy(35,10);cout<< "==================================================";
- gotoxy(35,11);cout<< "MAAF STOK BARANG YANG ANDA MASUKKAN TERLALU BANYAK";
- gotoxy(35,12);cout<< "==================================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- stok.soffel=stok.soffel-beli.banyak[urutbrg];
- }
- else{
- system("color 0C");
- system("cls");
- gotoxy(38,10);cout<< "============================================";
- gotoxy(38,11);cout<< "MAAF STOK BARANG YANG ANDA PILIH SUDAH HABIS";
- gotoxy(38,12);cout<< "============================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- break;
- case '5':
- beli.nmbrg[urutbrg]="Hot in cream 120 ml";
- beli.hrgbrg[urutbrg]=16000;
- if (stok.hic){
- gotoxy(76,14);cin>>beli.banyak[urutbrg];
- if (beli.banyak[urutbrg]>stok.hic){
- system("color 0C");
- system("cls");
- gotoxy(35,10);cout<< "==================================================";
- gotoxy(35,11);cout<< "MAAF STOK BARANG YANG ANDA MASUKKAN TERLALU BANYAK";
- gotoxy(35,12);cout<< "==================================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- stok.hic=stok.hic-beli.banyak[urutbrg];
- }
- else{
- system("color 0C");
- system("cls");
- gotoxy(38,10);cout<< "============================================";
- gotoxy(38,11);cout<< "MAAF STOK BARANG YANG ANDA PILIH SUDAH HABIS";
- gotoxy(38,12);cout<< "============================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- }
- break;
- case '6':
- system("cls");
- gotoxy(50,14);cout<< "=====================";
- gotoxy(50,15);cout<< "=SILAHKAN KLIK ENTER=";
- gotoxy(50,16);cout<< "=====================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- goto bawah;
- break;
- default :
- system("color 0C");
- system("cls");
- gotoxy(42,15);cout << "Input Salah Silahkan Masukkan Kembali" ;
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- getch();
- goto atas;
- break ;
- }
- beli.jumlah[no]=beli.jumlah[no]+(beli.hrgbrg[urutbrg]*beli.banyak[urutbrg]);
- gotoxy(39,15);cout<<"Ingin Menambah Pesanan?(y/t)";cin>>lg;
- if (lg=='y'){
- urutbrg=urutbrg+1;
- goto atas;
- }
- else{
- gotoxy(70,20);cout<<"Jumlah Yang Harus Dibayar: Rp."<<beli.jumlah[no];
- getch();
- total[no]=0;
- int a=4;
- system("cls");
- for (int i=1;i<=urutbrg;i++){
- gotoxy(4,a+1);cout<<"Nama Barang ke-"<<i<<" "<<beli.nmbrg[i];
- ngurut[no].nmbrg[i]=beli.nmbrg[i];
- gotoxy(4,a+2);cout<<"Harga Barang = "<<beli.hrgbrg[i];
- ngurut[no].hrgbrg[i]=beli.hrgbrg[i];
- gotoxy(4,a+3);cout<<"Banyak Pesanan = "<<beli.banyak[i];
- ngurut[no].banyak[i]=beli.banyak[i];
- ttl=beli.hrgbrg[i]*beli.banyak[i];
- gotoxy(4,a+4);cout<<"Harga Total = "<<ttl;
- a=a+5;
- }
- if (beli.jumlah[no]>300000){
- gotoxy(4,a-5+6);cout<< "Total Bayar Rp."<<beli.jumlah[no];
- gotoxy(4,a-5+7);cout<< "ANDA MENDAPAT DISKON SEBESAR 25%";
- diskon=beli.jumlah[no] * 25 / 100;
- beli.jumlah[no]-=diskon;
- }
- gotoxy(4,a-5+8);cout<<"Total Bayar Rp."<<beli.jumlah[no];
- no=no+1;
- }
- bawah:
- getch();
- }
- void LihatStok(){
- char tambah,plhstok,lg;
- int bnykstok;
- puncak:
- system("color 0B");
- system("cls");
- gotoxy(44,5);cout<< "================================";
- gotoxy(44,6);cout<< "=SISA STOK BARANG YANG TERSEDIA=";
- gotoxy(44,7);cout<< "================================";
- gotoxy(44,8);cout<< "Wardah gentle wash 50 ml = "<<stok.wardah;
- gotoxy(44,9);cout<< "Clean n clear oil control = "<<stok.cnc;
- gotoxy(44,10);cout<< "Garnier micellar cleansing ";
- gotoxy(44,11);cout<< "water for oily = "<<stok.garnier;
- gotoxy(44,12);cout<< "Soffell pink 80g = "<<stok.soffel;
- gotoxy(44,13);cout<< "Hot in cream 120 ml = "<<stok.hic;
- gotoxy(44,14);cout<< "================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- gotoxy(44,17);cout<< "Ingin Menambah Stok Barang?? (y/t): ";cin>>tambah;
- if (tambah=='y' && admin==1){
- atas:
- system("color 0B");
- system("cls");
- gotoxy(39,2);cout<< "=======================================";
- gotoxy(39,3);cout<< "[ =TAMBAH STOK BARANG= ]";
- gotoxy(39,4);cout<< "=======================================";
- gotoxy(39,6);cout<< "=1. Wardah gentle wash 50 ml (19k)=====";
- gotoxy(39,7);cout<< "=2. Clean n clear oil control (35k)====";
- gotoxy(39,8);cout<< "=3. Garnier micellar cleansing water for oily (35k)";
- gotoxy(39,9);cout<< "=4. Soffell pink 80g (15k)=============";
- gotoxy(39,10);cout<< "=5. Hot in cream 120 ml (16k)==========";
- gotoxy(39,11);cout<< "=======================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- gotoxy(39,13);cout<< "Pilih Stok Yang Ingin Ditambahkan (1-5) : ";
- gotoxy(39,14);cout<< "Masukkan Banyak Stok Yang Ingin Ditambahkan: ";
- gotoxy(81,13);cin>>plhstok;
- gotoxy(84,14);cin>>bnykstok;
- if (plhstok=='1'){
- stok.wardah=stok.wardah+bnykstok;
- }
- else if (plhstok=='2'){
- stok.cnc=stok.cnc+bnykstok;
- }
- else if (plhstok=='3'){
- stok.garnier=stok.garnier+bnykstok;
- }
- else if (plhstok=='4'){
- stok.soffel=stok.soffel+bnykstok;
- }
- else if (plhstok=='5'){
- stok.hic=stok.hic+bnykstok;
- }
- else{
- system("cls");
- system("color 0C");
- gotoxy(45,16);cout<< "INPUT YANG ANDA MASUKKAN SALAH!!";
- getch();
- goto atas;
- }
- gotoxy(45,16);cout<< "Ingin Tambah Lagi?? (y/t) : ";cin>>lg;
- if (lg=='y'){
- goto atas;
- }
- else{
- goto puncak;
- }
- }else if(tambah=='y' && admin==0){
- system("color 0C");
- system("cls");
- gotoxy(45,13);cout<< "==============================";
- gotoxy(45,14);cout<< "[ ANDA BUKAN SEBAGAI ADMIN!! ]";
- gotoxy(45,15);cout<< "==============================";
- getch();
- goto puncak;
- }
- }
- void LihatHistory(){
- int b,c;
- b=5;
- system("cls");
- system("color 0D");
- gotoxy(50,1);cout<< "=====================";
- gotoxy(50,2);cout<< "[ HISTORY PEMBELIAN ]";
- gotoxy(50,3);cout<< "=====================";
- for (int i=1;i<=no-1;i++){
- gotoxy(3,b);cout<< "Struk Pembelian Ke-"<<i;
- for (int a=1;a<=pengurut[i];a++){
- gotoxy(3,b+1);cout<< "Barang ke-"<<a;
- gotoxy(3,b+2);cout<< "Nama Barang = "<<ngurut[i].nmbrg[a];
- gotoxy(3,b+3);cout<< "Harga Barang = "<<ngurut[i].hrgbrg[a];
- gotoxy(3,b+4);cout<< "Banyak Pembelian = "<<ngurut[i].banyak[a];
- b=b+6;
- }
- gotoxy(3,b);cout<< "Total Pembayaran = "<<beli.jumlah[i];
- gotoxy(1,b+1);cout<< "~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=";
- b=b+2;
- }
- gotoxy(48,b); cout << "Created By KeluargaCemana";
- getch();
- }
- int main()
- {
- login();
- stok.wardah=100;
- stok.cnc=100;
- stok.garnier=100;
- stok.soffel=100;
- stok.hic=100;
- no=1;
- satu:
- system("color 09");
- system("cls");
- gotoxy(42,3);cout << "=====================================";
- gotoxy(42,4);cout << "[ Program Penjualan Skincare ]";
- gotoxy(42,5);cout << "=====================================";
- gotoxy(42,6);cout << "~ 1. Beli Produk ~~~~~~~~~~~~~~~~~~~~";
- gotoxy(42,7);cout << "~ 2. Lihat Stok Produk ~~~~~~~~~~~~~~";
- gotoxy(42,8);cout << "~ 3. Lihat History Pembelian ~~~~~~~~";
- gotoxy(42,9);cout << "~ 4. exit ~~~~~~~~~~~~~~~~~~~~~~~~~~~";
- gotoxy(42,10);cout <<"=====================================";
- gotoxy(42,11);cout <<"masukkan menu yang anda inginkan : ";
- gotoxy(42,12);cout <<"=====================================";
- gotoxy(48,28); cout << "Created By KeluargaCemana";
- gotoxy(77,11);cin >> lagi;
- if (lagi == '1'){
- BeliProduk();
- goto satu;
- }
- else if (lagi == '2'){
- LihatStok();
- goto satu;
- }
- else if (lagi == '3'){
- if (admin==1){
- LihatHistory();
- goto satu;
- }else{
- system("color 0C");
- system("cls");
- gotoxy(45,13);cout<< "==============================";
- gotoxy(45,14);cout<< "[ ANDA BUKAN SEBAGAI ADMIN!! ]";
- gotoxy(45,15);cout<< "==============================";
- getch();
- goto satu;
- }
- }
- else if (lagi == '4'){
- system("cls");
- system("color 0C");
- gotoxy(48,10);cout<< "=========================";
- gotoxy(48,11);cout<< "=====PROGRAM SELESAI=====";
- gotoxy(48,12);cout<< "=========================";
- getch();
- exit (0);
- }
- else {
- gotoxy(42,14);cout<< "INPUT YANG ANDA MASUKKAN SALAH!!";
- getch();
- goto satu;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment