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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
char id='a'; //for admin
class User
{
char FName[15];
char LName[15];
char ID[16];
int dd,mm,yyyy;
char Address1[40],Address2[40];
char City[15];
char State[15];
char Country[15]; //of Current residense
char Litrate; //y or n
char Category; //g->OP o->OBC s->ST/SC
char Password[20];
char Status; //a->active b->banned r->request/applied p->under process
char Security_Ques[25];
char Answer[10];
public:
int SNo;
void Name(char []);
void Pass(char []);
char Input();
void Checkreq();
void Details(User ,char ); //char o->applied c->created
char Search_User(User );
void Request();
}u1;
char User::Input()
{
clrscr();
char ch='n';
cin.ignore();
gotoxy(10,30);
cout<<"Note:";
gotoxy(15,2);
cout<<"Enter details for ID";
gotoxy(5,5);
cout<<"First Name(include Middle name):";
cin.getline(FName,15);
gotoxy(5,6);
cout<<"Last Name:";
cin.getline(LName,15);
gotoxy(5,7);
cout<<"Date of Birth:";
gotoxy(7,8);
cout<<"Date(dd):";
cin>>dd;
gotoxy(7,9);
cout<<"Month(mm):";
cin>>mm;
gotoxy(7,10);
cout<<"Year(yyyy):";
cin>>yyyy;
while(dd<0 || dd>31 || (mm%2==0 && dd==31) || (mm==2 && yyyy%4!=0 && dd>28) || (mm==2 && yyyy%4==0 && dd>29))
{
gotoxy(15,30);
cout<<"Incorrect Data!Re-enter Date, Month and Year";
gotoxy(7,8);
clreol();
gotoxy(7,9);
clreol();
gotoxy(7,10);
clreol();
gotoxy(7,8);
cout<<"Date(dd):";
cin>>dd;
gotoxy(7,9);
cout<<"Month(mm):";
cin>>mm;
gotoxy(7,10);
cout<<"Year(yyyy):";
cin>>yyyy;
gotoxy(15,30);
clreol();
}
cin.ignore();
gotoxy(5,11);
cout<<"Enter Address:";
gotoxy(7,12);
cout<<"Line 1:";
cin.getline(Address1,40);
gotoxy(7,13);
cout<<"Line 2:";
cin.getline(Address2,40);
gotoxy(5,14);
cout<<"City:";
cin.getline(City,15);
gotoxy(5,15);
cout<<"State:";
cin.getline(State,15);
gotoxy(5,16);
cout<<"Country:India";
strcmp(Country,"India");
gotoxy(5,17);
cout<<"Litrate(y/n):";
cin>>Litrate;
while(Litrate!='y' && Litrate!='Y' && Litrate!='n' && Litrate!='N')
{
gotoxy(15,30);
cout<<"Only y or n allowed";
gotoxy(5,17);
clreol();
gotoxy(5,17);
cout<<"Literate(y/n):";
cin>>Litrate;
gotoxy(15,30);
clreol();
}
gotoxy(15,30);
cout<<"g->general O->OBC s->ST/SC";
gotoxy(5,18);
cout<<"Category:";
cin>>Category;
while(Category!='g' && Category!='o' && Category!='s')
{
gotoxy(15,30);
clreol();
gotoxy(15,30);
cout<<"Only g,o or s allowed";
getch();
gotoxy(15,30);
clreol();
gotoxy(5,18);
clreol();
gotoxy(15,30);
cout<<"g->general O->OBC s->ST/SC";
gotoxy(5,18);
cout<<"Category:";
cin>>Category;
}
cin.ignore();
gotoxy(15,30);
clreol();
gotoxy(5,19);
cout<<"Select Password:";
cin.getline(Password,20);
gotoxy(10,28);
cout<<"(Password more than 5 character but less than 20)";
while(strlen(Password)<6 || strlen(Password)>20)
{
gotoxy(15,30);
cout<<"Invalid Password!!!Re-Try";
getch();
gotoxy(5,19);
clreol();
gotoxy(5,19);
cout<<"Select Password:";
cin.getline(Password,20);
gotoxy(15,30);
clreol();
}
gotoxy(10,28);
clreol();
gotoxy(5,21);
cout<<"Enter a security Question:";
cin.getline(Security_Ques,25);
gotoxy(5,22);
cout<<"Enter its answer:";
cin.getline(Answer,10);
if(id=='a')
{
Status='p';
gotoxy(5,24);
cout<<"Enter ID:";
cin.get(ID,17); //Here date changes
while(strlen(ID)!=16)
{
gotoxy(15,30);
cout<<"ID must be 16 characters long!!!!";
getch();
gotoxy(5,24);
clreol();
gotoxy(5,24);
cout<<"Enter ID:";
cin.ignore();
cin.get(ID,17);
gotoxy(15,30);
clreol();
}
}
else
{
Status='r';
strcpy(ID,"ABCDEFGH12345678");
}
cout<<"\n"<<dd;
gotoxy(15,30);
cout<<"Press any key to continue...";
getch();
//Details(u1,'o');
gotoxy(5,30);
cout<<"1) Create";
gotoxy(25,30);
cout<<"2) Modify";
gotoxy(35,30);
cout<<"3) Cancel";
ch=getch();
while(ch!='1' && ch!='2' && ch!='3')
{
gotoxy(15,35);
cout<<"Error in Input!!!Re-enter";
getch();
gotoxy(15,35);
clreol();
ch=getch();
}
switch(ch)
{
case'1':ch='y';
break;
case'2':
break;
case'3':ch='n';
break;
}
return(ch);
} //sends to file write
void main()
{
User user;
user.Input();
}
|