Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio>
- #include <stdio>
- #include "stdlib.h"
- class alfamart
- {
- public:
- void title()
- {
- cout<<"\t\tPT SUMBER ALFARIA TRIJAYA (ALFAMART)"<<endl;
- cout<<"\t\t\tJl Tasikmalaya No 06"<<endl;
- cout<<"---------------------------------------------------------"<<endl;
- }
- void garis()
- {
- cout<<"---------------------------------------------------------"<<endl;
- }
- int pilih;
- char nim[10],pass[10],jabatan[20],nama[20];
- };
- class menu
- {
- public:
- void login()
- {
- int count=0;
- alfamart alfa;
- menu alfa1;
- alfa.title();
- do
- {
- cout<<"NIM\t\t:";cin>>alfa.nim;
- cout<<"Password\t:";cin>>alfa.pass;
- if(strcmp(alfa.nim,"12345")==0 && strcmp(alfa.pass,"54321")==0)
- {
- strcpy(alfa.jabatan,"Kepala Toko");
- strcpy(alfa.nama,"IRWAN");
- count=10;
- }
- else
- {
- cout<<"Salah Password"<<endl;
- count+=1;
- }
- }
- while(10>count);
- clrscr();
- alfa.title();
- cout<<"Nama\t:"<<alfa.nama<<endl;
- cout<<"Nim\t:"<<alfa.nim<<endl;
- cout<<"Jabatan:"<<alfa.jabatan<<endl;
- alfa.garis();
- cout<<endl;
- cout<<endl;
- cout<<endl;
- cout<<"Pilihan Menu :"<<endl;
- cout<<"1.Input Data"<<endl;
- cout<<"2.Keluar"<<endl;
- cout<<"Input Pilihan Anda :";cin>>alfa.pilih;
- clrscr();
- if(alfa.pilih==1)
- {
- alfa1.input();
- }
- else
- exit(1);
- getch();
- }
- void input()
- { alfamart alfa;
- alfa.title();
- cout<<"Nama\t:"<<alfa.nama<<"\t\t\tJabatan\t:"<<alfa.jabatan;
- }
- };
- void main()
- {
- alfamart alfa;
- menu alfa1;
- alfa.title();
- cout<<"Selamat Datang di alfamart"<<endl<<endl;
- cout<<"Pilihan Menu :"<<endl;
- cout<<"1.Login"<<endl;
- cout<<"2.Keluar"<<endl;
- cout<<"Input Pilihan Anda :";cin>>alfa.pilih;
- clrscr();
- if(alfa.pilih==1)
- {
- alfa1.login();
- }
- else
- exit(1);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment