Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio>
- #include <stdlib>//stdlibb buat fungsi exit
- struct alfamart {
- int login;
- char nip[20],pass[20];
- };
- //fungsi garis
- void garis(){
- cout<<"-=============================================================-"<<endl;
- }
- //fungsi Judul
- void header(){
- garis();
- cout<<"\t\tPT SUMBER ALFARIA TRIJAYA (ALFAMART)"<<endl;
- cout<<"\t\t\tJL TASIKMALAYA NO 56 "<<endl;
- garis();
- }
- //fungsi login kedua
- void masuk(){
- alfamart login;
- header();
- int sapas=1;//salah password
- do{//Melakukan pengulangan jika sebanyak tiga kali jika salah password
- cout<<"NIP\t\t :";cin>>login.nip;
- cout<<"PASSWORD\t :";cin>>login.pass;
- if(strcmp(login.nip,"12345")==0&& strcmp(login.pass,"54321")==0 ){
- cout<<"true";
- sapas=3;
- }else{
- cout<<"false";
- sapas+=1;
- }
- }
- while(sapas<3);
- }
- //fungsi login pertama
- void login1(){
- alfamart login;
- header();
- cout<<"1.MASUK"<<endl;
- cout<<"2.KELUAR"<<endl<<endl<<endl;
- cout<<"Silahkan Input [1/2] :";cin>>login.login;
- if(login.login==1){
- clrscr();
- masuk();
- }else{
- exit(1);
- }
- }
- //=================MAIN=====================
- main(){
- login1();
- getch();
- }
- //================END MAIN =================
Advertisement
Add Comment
Please, Sign In to add comment