C++ Final Project
C++ Final Project
A lot of effort has gone into the making of this project. However,
its completion would not have been possible without the constant
support and motivation of many individuals. We would like to
extend our sincere thanks to them.
We would like to make a special mention of gratitude regarding
our teacher, Ms. S.S.Saranya, who provided us with the
opportunity to do this wonderful project on the topic Criminal
Record Management System. We would also like to thank our
friends and families who were with us at each stage before it all
finally culminated in the project morphing into its current form; a
tedious task, considering the limited time we had.
ABSTRACT
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<process.h>
#include<dos.h>
ifstream fin; //File handling
ofstream fout;
int count=0;
class criminal //Main class
{ int sno,age;
char
name[20],gender,residency[50],fname[20],reason[20];
public:
void input(); //Function for giving the details of the
criminal as input into a file
void output(); //Function for displaying the details of the
//criminal as input from the file
void rno(int x); //Function for searching a particular
//record by giving the rno as input
void del(); // Function for deleting a particular record by
//giving the name as input
int f1(char na[20])
{return strcmpi(name,na);
}
int f2(int x)
{ int a=0;
if(sno==x)
return a;
else
return (a+1);
}
char* getname()
{ return name;
}
} s;
void criminal:: input ()
{ clrscr();
int a=1;
ofstream fout;
if(!fout)
{ cout<<"Cannot be created ";
return;
}
fout.open("input.dat",ios::binary|ios::out); //File opened for
//entering the details
char ch;
do
{ //Details
cout<<"Enter the serial number = ";
cin>>sno;
cout<<"Enter name = ";
gets(name);
cout<<"Enter Father name =";
gets(fname);
cout<<"Enter age = ";
cin>>age;
cout<<"Enter the reason for arrest =";
gets(reason);
cout<<"Enter gender(M/F) = ";
cin>>gender;
while(a==1)
{ if(gender=='m'||gender=='f')
{a=0;
break;
}
else
{ cout<<"Enter correct gender \n";
}
}
cout<<"Enter residency =";
gets(residency);
fout.write((char *)&s,sizeof(s));
cout<<"Do you want to enter more?(Y/N)\n";
cin>>ch;
}while(ch=='Y'||ch=='y');
fout.close(); //File closed after details are recorded
}
void criminal :: output()
{
cout<<"\nSerial number = "<<sno;
cout<<"\nName = "<<name;
cout<<"\nFather's name = "<<fname;
cout<<"\nAge = "<<age;
cout<<"\nReason = "<<reason;
cout<<"\nGender = "<<gender;
cout<<"\nResidency = "<<residency;
void main()
{
clrscr();
int i,n,x,d;
char ch,na[20];
clrscr();
int choice,j;
clrscr();
for(i=0;i<10;i++)
cout<<"\n";
cout<<"\t\t\t\t"<<" "<<"WELCOME!!!!\n\n";
cout<<"\n\t\t\t"<<" "<<"PRESS ANY KEY TO
CONTINUE \n";
getch();
clrscr();
char pass[20],p[20];
strcpy(pass,"shreya"); //Password
for(i=3;i>0;i--)
{
cout<<"\n\n\n\n\n\n\n\n\n\n\t\t\t\tEnter password = \n";
cout<<"\n\n\t\t\t\t";
for(int u=0;u<6;u++)
{p[u] = getch();
if(int(p[u])==8){
cout<<"\b";
u--;
cout<<" ";
cout<<"\b";
}
else
{
cout<<"*";
}
}
p[u]='\0';
clrscr();
if(strcmp(p,pass)==0)
{ cout<<" \t\t\t\t\tCORRECT!!!!!";
break;
}
else
{ if((i-1)!=1)
cout<<"\n\n\n\n\n\n\n\n\n\n\t\t\t You have
"<<i-1<<" chances left ";
else
cout<<"\n\n\n\n\n\n\n\n\n\n\t\t\t You have
"<<"1"<<" chance left ";
}
}
clrscr();
if(i==0)
{ cout<<"Wrong password!!!!!";
exit(0);
}
clrscr();
do
{ clrscr();
for(int c=0;c<40;c++)
cout<<"*-";
cout<<"\t\t\t\tENTER YOUR CHOICE";
cout<<"\n\t1) Input Data\n\t2) Display all \n\t3)
Search by serial number \n\t4) Delete a record \n\t5) Exit\n";
for( c=0;c<40;c++)
cout<<"*-";
cin>>choice;
switch(choice)
{ case 1: s.input();
break;
case 2: fin.seekg(0);
fin.open("input.dat",ios::binary);
while( fin.read((char*)&s,sizeof(s)))
{ s.output();
cout<<"\n\n\n";
}
break;
}
cout<<"\nDo you want to go back to the main menu
?(Y/N)\n";
cin>>ch;
} while(ch=='Y'||ch=='y');
getch();
}
//End of Code
SCREEN SHOTS OF OUTPUT
1. WELCOME PAGE
2. AUTHENTICATION
2.a IF PASSWORD IS NOT CORRECT