-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin2.cpp
148 lines (118 loc) · 4.83 KB
/
admin2.cpp
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#include<iostream>
#include<stdlib.h>
#include<fstream>
#include<cstring>
#include"delete(1).cpp"
#include"pass.cpp"
#include"displaydemo2.cpp"
using namespace std;
class Admin
{
public:
std::string name;
void adinterface();
void password();
};
void adinterface()
{
std::string names,id,age,category,gender;
std::string nametobechecked;
int choices;
char chs='y';
char answer;
system("cls");
cout<<"\t\t**********************WELCOME ADMINISTRATOR*****************************************\n\n\n";
while(chs!='N'||'n')
{
cout<<"\t1)Create a New User \n\n";
cout<<"\t2)Accessing an Existing User \n\n";
cout<<"\t3)Delete User \n\n";
cout<<"\t4)Change the current password \n\n";
cout<<"\t5)No of Existing Users & Logged in Info \n \n";
cout<<"\t6)Exit \n\n";
cout<<"\tEnter Your Choice : ------>>> ";
cin>>choices;
char answer='y';
switch(choices)
{
case 1: {
system("cls");
cout<<"Creating New user \n"; //completed
ofstream fo;
fo.open("login.csv",ios::app);
while( answer=='y')
{
cout<<"Entering details of people whose record is to be inserted \n";
std::cout<<"Enter Name\n";
std::cin>>names;
std::cout<<"Enter Id \n";
std::cin>>id;
std::cout<<"Enter Category(A|U)? \n";
std::cin>>category;
std::cout<<"Enter Age \n";
std::cin>>age;
std::cout<<"Enter gender \n";
std::cin>>gender; // calling the function to input the files
fo<<names<<","<<id<<","<<category<<","<<age<<","<<gender<<",\n";
cout<<"Do you want to enter any details further?(y|n) \n";
cin>>answer;
}
fo.close();
}
break;
case 2:{
system("cls");
cout<<"\tEnter the name of the existing user whose details you want to view";//completed
std::getline(std::cin,nametobechecked);
cout<<"\n\tAccessing the details...................";
showdetails();
}
break;
case 3:{
system("cls");
cout<<"\tEnter the Name of the user to be deleted";
std::getline(cin,nametobechecked);
cout<<"\tDeleting Existing User...................";
del();
}
break;
case 4: { char ans;
system("cls");
cout<<"\n\tAre you sure you want to change the current password(Y/N) ?";//completed
cin>>ans;
if(ans=='Y'||'y')
{
Classes::PasswordA a;
a.change();
}
else
exit(0);
break;
}
break;
case 5 :
{system("cls");
cout<<"*******************************************************************************************************\n";
cout<<"The Number of times user's have logged into the app :\t \t";
std::cout<<"ptr";
break;}
case 6:{
system("cls");
try{
throw 0;
}
catch(...)
{
cout<<"Thank You for using \n You have exited administrator interface \n";
exit(0);
}
}
break;
default:
system("cls");
cout<<"The choice you selected is invalid \n";
cout<<"Do you want to retry? \n";
cin>>chs;
}
}
}