Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <iostream.h>
- #include <iomanip.h>
- #include <string.h>
- #include <windows.h>
- long potong (int p){
- float diskon;
- if(p >= 100000)
- {
- diskon = p * 0.10;}
- else
- {
- p = 0;
- diskon = 0;}
- return(p - diskon);
- }
- title()
- {
- cout<<" Grillicious"<<endl;
- cout<<" Yummy Grills and More"<<endl;
- cout<<" ==========================="<<endl;
- }
- garis()
- {
- cout<<"============================================";
- }
- menu(){
- cout<<"\n*************************************************"<<endl;
- cout<<"** Today's Menu **"<<endl;
- cout<<"*************************************************"<<endl;
- cout<<"** Meal **"<<endl;
- cout<<"** 1.Sosis Ayam Bakar : Rp.10000 -, **"<<endl;
- cout<<"** 2.Sosis Sapi Bakar : Rp.12000 -, **"<<endl;
- cout<<"** 3.Sosis Black Papper Bakar : Rp.11000 -, **"<<endl;
- cout<<"** 4.Sosis Cheese Bakar : Rp.13000 -, **"<<endl;
- cout<<"** 5.Bakso Bakar : Rp.8000 -, **"<<endl;
- cout<<"** **"<<endl;
- cout<<"** Beverages **"<<endl;
- cout<<"** 6.Coke : Rp.5000-, **"<<endl;
- cout<<"** 7.Ice Tea : Rp.5000-, **"<<endl;
- cout<<"** 8.Water : Rp.3000-, **"<<endl;
- cout<<"** **"<<endl;
- cout<<"************************************************"<<endl;
- }
- void delay(int a)//Loading Screen
- {
- for(int x=0;x<a*50;x++)
- {
- for(int y=0;y<a*50;y++)
- {}
- }
- }
- void readPass(char*);
- main() //Ini main jangan ngilang lagi
- {
- gotoxy(32,11);cout<<"============";
- gotoxy(32,13);cout<<"============";
- for(int i=0;i<=100;i++){
- delay(80);
- gotoxy(32,12);cout<<"loading "<<i<<"%";
- }
- char user[40];
- char pass[30],username[30][30]={"doni","bagus","eko","pandu"};
- char lagi;
- int input;
- //Tampilan Awal
- clrscr();
- title();
- cout<<"Welcome to Grillicious Yummy Grills and More"<<endl;
- cout<<"Choose your menu to work: "<<endl;
- garis();
- cout<<"\n 1.Input Menu"<<endl;
- cout<<" 2.Logout"<<endl;
- garis();
- cout<<"\n Input here: ";
- cin>>input;endl;
- clrscr();
- title();
- if(input==1){
- garis();
- cout<<"\n User name: ";
- cin>>user;
- cout<<endl;
- cout<<" Password: ";
- cin>>pass;
- if(strcmp(username[0],user) == 0
- || strcmp(username[1],user) == 0
- || strcmp(username[2],user) == 0
- || strcmp(username[3],user) == 0
- && strcmp ("grillicious",pass) == 0){
- void loading();
- cout << "\n======================================= \n\n";Sleep(600);
- cout << "| Anda Berhasil Login |"<<endl;Sleep(1000);
- cout << "======================================= \n\n";Sleep(600);
- cout<<endl;
- goto menu;
- }
- if(pass!="grillicious")
- { cout << "==========================================\n\n";Sleep(600);
- cout << "| PASSWORD/USERNAME ANDA SALAH!!!! |\n"<<endl;Sleep(1000);
- cout << "==========================================\n\n";Sleep(600);
- cout<<endl;
- return 0;
- }}
- //Tampilan input
- do{menu:
- clrscr();
- title();
- cout<<"\n** Logged Username: "<<user<<" **"<<endl;
- cout<<"** Today's Promo: **"<<endl;
- cout<<"** -Discount 5%,Setiap transaksi Rp.100.000-, atau lebih- **"<<endl;
- menu();
- int i,jp;
- struct{
- int banyak;
- char item[30];
- long harga,jumlah ;
- }array[100];
- struct{
- char nama[20];
- int m;
- }data;
- cout<<"Nama Pelangggan: ";
- gets(data.nama);
- cout<<"Input Jumlah Pesanan: ";
- cin>>jp;
- for(i=1;i<=jp;i++){
- cout<<endl;
- cout<<"Data ke-"<<i<<endl;
- cout<<"Input Menu: ";
- cin>>data.m;
- if(data.m==1){
- strcpy(array[i].item,"Sosis ayam bakar");
- array[i].harga=10000;
- }
- if(data.m==2){
- strcpy(array[i].item,"Sosis sapi bakar");
- array[i].harga=12000;
- }
- if(data.m==3){
- strcpy(array[i].item,"Sosis Black pepper bakar");
- array[i].harga=11000;
- }
- if(data.m==4){
- strcpy(array[i].item,"Sosis Cheese Bakar");
- array[i].harga=13000;
- }
- if(data.m==5){
- strcpy(array[i].item,"Bakso Bakar");
- array[i].harga=8000;
- }
- if(data.m==6){
- strcpy(array[i].item,"Coke");
- array[i].harga=5000;
- }
- if(data.m==7){
- strcpy(array[i].item,"Ice Tea");
- array[i].harga=5000;
- }
- if(data.m==8){
- strcpy(array[i].item,"Water");
- array[i].harga=3000;
- }
- cout<<endl;
- cout<<"Anda memesan: "<<array[i].item<<endl;
- cout<<"Dengan harga: Rp."<<array[i].harga<<endl;
- cout<<"Input Banyaknya: ";
- cin>>array[i].banyak;
- array[i].jumlah=array[i].harga*array[i].banyak;
- cout<<"Jumlah: "<<array[i].jumlah;
- cout<<endl;}
- //Tampilan Output
- struct{
- long total,dibayar,kembali,kurang,disc;
- }data2;
- data2.total=0;
- for (i=1;i<=jp;i++)
- {
- data2.total+=array[i].jumlah;
- }
- clrscr();
- title();
- cout<<"Nama Pelanggan :"<<data.nama<<endl;
- cout<<"Daftar menu yang dipesan"<<endl;
- cout<<"======================================================"<<endl;
- cout<<"No Item Price Qty Total "<<endl;
- cout<<"======================================================"<<endl;
- for(i=1;i<=jp;i++){
- cout<<setiosflags(ios::left)<<setw(5)<<i;
- cout<<setiosflags(ios::left)<<setw(24)<<array[i].item;
- cout<<setprecision(30)<<setw(10)<<array[i].harga;
- cout<<setprecision(20)<<setw(10)<<array[i].banyak;
- cout<<setprecision(20)<<setw(10)<<array[i].jumlah<<endl;
- }
- cout<<"Total belanja: "<<data2.total<<endl;
- cout<<"Masukkan uang yang dibayar: ";
- cin>>data2.dibayar;endl;
- if(potong(data2.total <= 0)){
- data2.disc = 0;}
- else
- {
- data2.disc = potong(data2.total);
- }
- if(data2.disc <= 0){
- cout<<"\n Anda tidak mendapatkan Discount "<<endl;
- cout<<"\n Diskon 5% jika belanja minimal Rp.100.000-,";
- }
- else{
- cout<<"\nAnda mendapatkan diskon sebesar: "<<data2.disc;
- }
- if(data2.disc <= 0){
- data2.kembali=data2.dibayar-data2.total;}
- else{
- data2.kembali=data2.dibayar-data2.disc;
- }
- if (data2.kembali < 0)
- {
- data2.kurang=data2.kembali*(-1);
- cout<<"\nMaaf uang Anda kurang "<<data2.kurang<<endl;
- }
- else
- {cout<<"\nUang kembali: "<<data2.kembali;}
- cout<<endl;
- cout<<"------------------------------------------------------"<<endl;
- cout<<" HARGA SUDAH TERMASUK PPN"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- cout<<" TERIMA KASIH ATAS KUNJUNGAN ANDA"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- cout<<"\n Apakah anda ingin melakukan transaksi lagi ? [Y/T]";
- cin>>lagi;
- }while(lagi=='Y'||lagi=='y');
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement