#include <iostream>
#include <string>
#include <conio.h>
#include <stdio.h>
#include <Windows.h>
using namespace std;
void login();
void outbreak();
void inbreak();
void logout();
string getpass(const char *prompt,bool show_asterisk=true){ const char BACKSPACE=8; const char RETURN=13; string password; unsigned char ch=0; cout <<prompt; DWORD con_mode; DWORD dwRead; HANDLE hIn=GetStdHandle(STD_INPUT_HANDLE); GetConsoleMode(hIn,&con_mode); SetConsoleMode(hIn,con_mode & ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT)); while(ReadConsoleA(hIn,&ch,1,&dwRead,NULL) && ch !=RETURN) { if(ch==BACKSPACE) { if(password.length()!=0) { if(show_asterisk) cout <<"\b \b"; password.resize(password.length()-1); } } else { password+=ch; if(show_asterisk) cout <<'*'; } } cout <<endl; return password;}
void (*array[4])()={login,outbreak,inbreak,logout};
int main()
{
int x;
cout<<"Welcome to Advanced Sys Admin ";
cout<<endl;
cout<<"Login - 1\nBreak - 2\nIn From Break - 3\nClock Out - 4\n";
cout<<"Enter Choice: ";
cin>>x;
if(x==1)
{
array[0]();
}
else if(x==2)
{
array[1]();
}
else if(x==3)
{
array[2]();
}
else if(x==4)
{
array[3]();
}
else if(x<4 || x>0)
{
return 0;
}
}
void login()
{
int x;
system("cls");
cout<<"Enter Username: ";
cin>>x;
const char *password="cervaza";
string attempt=getpass("Enter Password: ",true);
if(attempt == password && x == 1337)
{
cout<<"You are now clocked in!"<<endl;
cout<<"have a good shift!"<<endl;
}
else
{
cout<<"Wrong username/password"<<endl;
}
system("pause");
}
void outbreak()
{
cout<<"Out on break"<<endl;
}
void inbreak()
{
cout<<"In from Break"<<endl;
}
void logout()
{
cout<<"Successfully Clocked out"<<endl;
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.