-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (39 loc) · 1.21 KB
/
Copy pathmain.cpp
File metadata and controls
46 lines (39 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <string>
#include <fstream> // For file operations
#include "admin.h" // Include the header file for admin functions
#include "user.h" // Include the header file for user functions
#include "ration.h" // Include the header file for ration functions
using namespace std;
// Main function
// This is the entry point of the program
int main()
{
string username, password, role;
// displaying project title
cout << " smart ration distribution system\n";
cout << "-------------------------------\n";
// asking username for their role
cout << "login as (admin/user): ";
cin >> role;
// take user name and and password
cout << "enter username: ";
cin >> username;
cout << "enter password: ";
cin >> password;
// check call respective menu and credentials
if (role == "admin" && username == "admin" && password == "admin123")
{
adminMenu(); // Admin menu
}
else if (role == "user" && username == "user" && password == "user123")
{
userMenu(); // User menu
}
else
{
// invalid login message
cout << "Invalid credentials or role. Please try again.\n";
}
return 0; // end of main function
}