More Related Content Similar to Student Data Base Using C/C++ Final Project (20) Student Data Base Using C/C++ Final Project4. int main()
{
char hid[11];
for (int t=0;t<10;t++)
hid[t]=0;
strcpy(user.name,"ABC");
strcpy(user.pass,"ABC");
pass();
getch();
}
void pass() //defination of password
{ system("cls");
char name[20];
char password[20];
cout<<"Enter user name"<<"t:";
cin>>name;
cout<<"Enter password"<<"t:";
cin>>password;
int c,c1;
int i=0;
char pw;
c=strcmp(name,user.name);
c1=strcmp(password,user.pass);
if(c==0&&c1==0)
{
}
else
system("cls");
cout<<"welcome menue"<<endl;
menu();
getch();
if(c!=0||c1!=0)
{ system("cls");
cout<<"login not match try again";
}
getch();
pass();
// cout<<"modify passw";
}
5. void menu()
{ system("cls");
cout<<"ttt______________________________"<<endl;
cout<<"ttttwelcome to Menu"<<endl;
cout<<"tttt1:Enter Record"<<endl;
cout<<"tttt2:Show Record"<<endl;
cout<<"tttt3:Modify Record"<<endl;
cout<<"tttt4:Hide Record"<<endl;
cout<<"tttt5:Delete Record"<<endl;
cout<<"tttt6:Modify Password"<<endl;
cout<<"tttt7:Search Record"<<endl;
cout<<"tttt8:Exit Menu"<<endl;
cout<<"ttt______________________________"<<endl;
int choice;
cout<<"Enter your choice:t";
cin>>choice;
switch(choice)
{
case 1:
entrec();
break;
case 2:
show();
break;
case 3:
mdf();
break;
case 4:
hid();
break;
case 5:
case 6:
srch();
del();
break;
modpass();
break;
case 7:
break;
case 8:
exit();
}
menu();
break;
6. }
void modpass()
{ system("cls");
cout<<"ttEnter new password"<<endl;
char pw;
int i=0;
cin>>user.pass;
system("cls");
cout<<"ttPassword Cahnged"<<endl;
cout<<"ttPress Enter to Continue"<<endl;
pass();
getch();
}
void entrec()
{ system("cls");
cout<<"enter number of record you want to add"<<endl;
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<"_______________"<<endl;
cout<<"enter 1st name :t";
cin>>p[i].ful_name.first_name;
cout<<"enter last name:t";
cin>>p[i].ful_name.last_name;
cout<<"address
:t";
cin>>p[i].add;
cout<<"age
:t";
cin>>p[i].age;
cout<<"phon
:t";
cin>>p[i].phon_num;
cout<<"gender
:t";
cin>>p[i].gender;
getch();
}
}
void del()
{ system("cls");
cout<<"enter required out put numbert"<<endl;
int n,a;
cin>>n;
7. a=0;
char lname[20];
cout<<"enter last name to del record"<<endl;
cin>>lname;
for(int i=1;i<=n;i++){
if(strcmp(p[i].ful_name.last_name,lname)==0)
{
cout<<"t----------------------------------"<<endl;
cout<<"tfirst name:t"<<p[i].ful_name.first_name=='0';
cout<<"tlast name :t"<<(p[i].ful_name.last_name)=='0';
cout<<"taddress :t"<<p[i].add=='0';
cout<<"tphone# :t"<<p[i].phon_num=='0';
cout<<"tage
:t"<<p[i].age=='0';
cout<<"tgender :t"<<p[i].gender=='0';
cout<<"t----------------------------------"<<endl;
}a++;
cout<<"showing records:"<<a<<endl;
getch();
}
}
void mdf()
{
system("cls");
int n;
char lname[20];
cout<<"enter last name"<<endl;
cin>>lname;
//cout<<"search upto ....num?"<<endl;
//cin>>n;
for(int i=1;i<=9;i++)
{
if(strcmp(p[i].ful_name.last_name,lname)==0)
{
cout<<"enter 1st name:t";
cin>>p[i].ful_name.first_name;
cout<<"enter last name:t";
cin>>p[i].ful_name.last_name;
cout<<"address:t";
cin>>p[i].add;
cout<<"age:t";
cin>>p[i].age;
cout<<"phon:t";
8. cin>>p[i].phon_num;
cout<<"gender:t";
cin>>p[i].gender;
}
//getch();
} getch();
menu();
}
void show1()
{ system("cls");
for(int i=1;i<=5;i++)
{
cout<<"t----------------------------------"<<endl;
cout<<"tfirst name:tt"<<p[i].ful_name.first_name<<endl;
cout<<"tlast name :tt"<<p[i].ful_name.first_name<<endl;
cout<<"taddress :tt"<<p[i].add<<endl;
cout<<"tage
:tt"<<p[i].phon_num<<endl;
cout<<"tgendr :tt"<<p[i].age<<endl;
cout<<"tphon num :tt"<<p[i].gender<<endl;
cout<<"t----------------------------------"<<endl;
} //break;
getch();
}
void exit()
{
exit(0);
}
void hid()
{
char hide[t];
for (int t=0;t<10;t++)
hide[t]=0;
char nme[20];
char h;
h=0;
cout<<"Please Enter last name to hide:";
cin>>nme;
for (int i=0;i<9;i++)
9. {
if (strcmp(p[i].ful_name.last_name,nme)==0)
{
hide[i]=1;
}
h=1;
}
cout<<"Hidden Successful"<<endl;
if (h==0)
cout<<"Record not Available"<<endl;
getch();
menu();
}
void srch()
{
system("cls");
char hide[10];
for (int t=0;t<10;t++)
hide[t]=0;
char nm[20];
char a;
a=0;
cout<<"nEnter Patient Last Name:";
cin>>nm;
for (int i=0;i<9;i++)
{
if (strcmp(p[i].ful_name.last_name,nm)==0 && hide[i]==0)
{
cout<<"tt------------------------";
cout<<"ntt1 Record match!!!n";
cout<<"nttFirst Name
:";
cout<<p[i].ful_name.first_name;
cout<<"nttPatient Last Name :";
cout<<p[i].ful_name.last_name;
cout<<"nttPatient Phone number:";
cout<<p[i].phon_num;
cout<<"nttPatient Age
:";
cout<<p[i].age;
cout<<"nttPatient gender :";
cout<<p[i].gender<<endl;
cout<<"tt------------------------n";
cout<<"nnn";
a=1;
}
10. }
getch();
menu();}
if (a==0)
cout<<"nRecord not availablen";
void show()
{
system("cls");
char hide[10];
for (int t=0;t<10;t++)
hide[t]=0;
for (int i=0;i<9;i++)
{
if (hide[i]==0&& strlen(p[i].ful_name.last_name)>0)
{
cout<<"nRecord number t :"<<i+1;
cout<<"nPatient First Namet :";
cout<<p[i].ful_name.first_name;
cout<<"nPatient Last Namet :";
cout<<p[i].ful_name.last_name;
cout<<"nPatient Phone numbert:";
cout<<p[i].phon_num;
cout<<"nPatient Address t:";
cout<<p[i].add;
cout<<"nPatient Age
t:";
cout<<p[i].age;
cout<<"nPatient gender t:";
cout<<p[i].gender;
cout<<endl;
}
}getch();
}
/*void del()
{ system("cls");
char name[22];
cout<<"enter 1st name to dell"<<endl;
cin>>name;
int a,b;
for(int i=0;i<=9;i++)
{
a=strcmp(name,p[i].ful_name.first_name);