Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- #include <stdlib.h>
- #define _CRT_SECURE_NO_WARNING
- using namespace std;
- void menu_header(void);
- void menu1(void);
- void menu1_func(void);
- void menu2(void);
- void menu2_func(void);
- void menu_admin(void);
- void loading(void);
- void option(char action);
- void daycounter();
- void secretword();
- int main(void)
- {
- char user[50], password[50];
- do
- {
- system("cls");
- cout << "\t\tWelcome" << endl;
- cout << "---------------------------------------" << endl;
- cout << "Username: ";
- cin.getline(user, 50);
- cout << "Password: ";
- cin.getline(password, 50);
- if ((strcmp(user, "user1")) == 0 && (strcmp(password, "user1") == 0))
- {
- loading();
- cout << "Login successful!" << endl;
- Sleep(1000);
- menu1();
- }
- else if ((strcmp(user, "user2")) == 0 && (strcmp(password, "user2") == 0))
- {
- loading();
- cout << "Login successful!" << endl;
- Sleep(1000);
- menu2();
- }
- else if ((strcmp(user, "admin")) == 0 && (strcmp(password, "admin") == 0))
- {
- cout << "Login successful!" << endl;
- Sleep(300);
- menu_admin();
- }
- else
- {
- loading();
- cout << "Login denied, Please try again";
- Sleep(1000);
- }
- } while ((strcmp(user, "user1") != 0) || (strcmp(password, "980914") != 0)||(strcmp(user, "user2") != 0) || (strcmp(password, "980711") != 0)||(strcmp(user, "admin") != 0) || (strcmp(password, "admin") != 0));
- }
- void loading(void)
- {
- cout << "-";
- Sleep(300);
- cout << "-";
- Sleep(300);
- cout << "-";
- Sleep(300);
- cout << "Loading";
- Sleep(300);
- cout << "-";
- Sleep(300);
- cout << "-";
- Sleep(300);
- cout << "-" << endl;
- Sleep(300);
- }
- void menu_header(void)
- {
- cout << "\t\tMenu"<<endl;
- cout << "------------------------------------" << endl;
- }
- void menu1_func(void)
- {
- cout << "1) Day Counter" << endl;
- }
- void menu2_func(void)
- {
- cout << "a) Secret Word Generator" << endl;
- }
- void menu1(void)
- {
- char action;
- system("cls");
- menu_header();
- cout << "Welcome home user1!"<<endl;
- menu1_func();
- cout << "Please enter your option" << endl;
- cin >> action;
- option(action);
- }
- void menu2(void)
- {
- char action;
- system("cls");
- menu_header();
- cout << "Welcome home user2!" << endl;
- menu2_func();
- cout << "Please enter your option" << endl;
- cin >> action;
- option(action);
- }
- void menu_admin(void)
- {
- char action;
- system("cls");
- menu_header();
- cout << "Hello Boss! What can I help you?" << endl;
- menu1_func();
- menu2_func();
- cout << "Please enter your option" << endl;
- cin >> action;
- option(action);
- }
- void option(char action)
- {
- if (action == 1)
- daycounter();
- else if (action == 'a' || action == 'A')
- secretword();
- }
- void daycounter()
- {
- cout << "daycounter" << endl;
- }
- void secretword()
- {
- cout << "secretword" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement