SlideShare a Scribd company logo
1 of 33
1
COMPUTER
SCIENCE
PROJECT
Criminal Record software
NAME : Aryan Varshneya
CLASS : XII -A1
ROLL NO. : 04
Index
Criminal Record Software Computer Science Project
2
1. Acknowledgement
2. Certificate
3. Introduction
4. Aim
5. Program Code
6. Output
7. Bibliography
3
Introduction
 C++ is designed with a bias toward system programming (e.g., for use in
embedded systems or operating system kernels), with performance, efficiency
and flexibility of use as its design requirements. C++ has also been found
useful in many other contexts, including desktop applications, servers (e.g. e-
commerce, web search or SQL servers), performance-critical applications (e.g.
telephone switches or space probes), and entertainment software. C++ is a
compiled language, with implementations of it available on many platforms
and provided by various organizations, including the FSF, LLVM, Microsoft
and Intel.
 C++ is standardized by the International Organization for Standardization
(ISO), with the latest (and current) standard version ratified and published by
ISO in September 2011 as ISO/IEC 14882:2011 (informally known as C++11).
The C++ programming language was initially standardised in 1998 as
ISO/IEC 14882:1998, which was then amended by the C++03, ISO/IEC
14882:2003, standard. The current C++11 standard supersedes these, with
new features and an enlarged standard library. Before the initial
standardization in 1998, C++ was developed by Bjarne Stroustrup at Bell
Labs, starting in 1979, who wanted an efficient flexible language (like the C
language), which also provided high-level features for program organization.
 Function: - A function is a group of statements that together perform a task.
o Every C++ program has at least one function, which is main(), and all
the most trivial programs can define additional functions.
o A function declaration tells the compiler about a function's name,
return type, and parameters.
o A function definition provides the actual body of the function.
o The C++ standard library provides numerous built-in functions that
your program can call. For example, function strcat() to concatenate
two strings, function memcpy() to copy one memory location to
another location and many more functions.
Criminal Record Software Computer Science Project
4
 Class: - A class is a user defined type or data structure declared with keyword
class that has data and functions (also called methods) as its members whose
access is governed by the three access specifiers private, protected or public
(by default access to members of a class is private). A class (declared with
keyword class) in C++ differs from a structure (declared with keyword struct)
as by default, members are private in a class while they are public in a
structure. The private members are not accessible outside the class; they can
be accessed only through methods of the class.
 Data FILE HANDLING: - The fstream library predefines a set of
operations for handling file related input and output. It defines certain
classes that help one perform file input and output. For ex, ifstream
class ties a file to the program for input; ofstream class ties a file to the
program for output; and fstream class ties a file to the program for
both input and output.
Aim
This program is used to keep details of
criminal’s in a police station.
Criminal Record Software Computer Science Project
5
This program consists of FIVE options
as follows: -
1. TO ADD RECORD/RECORDS
2. TO MODIFY RECORD/RECORDS
3. TO DISPLAY RECORD
4. TO DELETE RECORD
5. TO show LIST
6. TO QUIT
Program Code
#include<iostream.h>
Criminal Record Software Computer Science Project
6
#include<conio.h>
#include<stdio.h>
#include<fstream.h>
#include<string.h>
#include<stdlib.h>
#include<iomanip.h>
/*********************************************************************
* Structure for Date *
*********************************************************************/
struct date
{
int d;
int m;
int y;
};
/*********************************************************************
* Structure for Details of Crime of Criminal *
*********************************************************************/
struct court
{
char crime[20];
char act[20];
char cour[20];
char state[20];
};
/*********************************************************************
* Structure for Physical Description of Criminal *
*********************************************************************/
struct descp
{
char colour[20];
char face[20];
char imark[20]; //IDENTIFICATION MARKS (DEFORMITIES ETC.)
char height[6];
};
/*********************************************************************
* Structure for Details of F.I.R. *
*********************************************************************/
struct police
{
char station[50];
char fir_no[10];
date date_arrest;
};
/*********************************************************************
* Class ' CRIMINAL ' for getting all information about Convict*
*********************************************************************/
class criminal
{
char name[20];
char sex[3];
char conno[10];
Criminal Record Software Computer Science Project
7
char age[4];
char address[50]; //ADDRESS OF CRIMINAL BEFORE ARREST.
court COURT;
police POLICE;
descp des;
public:
int ncheck(char arr[]); // FUNCTION TO CHECK THAT INPUT IS NOT NUMERIC.
int s_check(char a[]); // FUNCTION TO CHECK THAT THE INPUT FOR
// SEX HAS ONLY 1 CHARACTER IN M OR F ONLY
void input(void);
void output(void);
void delete_rec(char con_no[]);
int dcheck(char n[]);
void display();
void remove();
int menu();
void modify();
void list();
void empty();
int concheck(char b[]);
};
// ====================>End of Class Criminal<========================
/*********************************************************************
* Function for Checking Whether Input is Correct *
*********************************************************************/
int criminal::ncheck(char arr[])
{
int i=0;
while (arr[i]!='0')
{
if(((arr[i]>64)&&(arr[i]<92))||((arr[i]>95)&&(arr[i]<124))||(arr[i]==' '))
{
i++;
continue;
}
else
{
cout<<"nINCORRECT INPUT. TRY AGAIN !!n ";
return 0;
}
}
return 1;
}
/*********************************************************************
* Function to Check whether Sex is Given Correctly *
*********************************************************************/
int criminal::s_check(char a[])
{
clrscr();
if(((a[0]=='m')||(a[0]=='f')||(a[0]=='M')||(a[0]=='F'))&&(a[1]=='0'))
{
Criminal Record Software Computer Science Project
8
return(1);
}
else
{
cout<<"n INCORRECT INPUT ,TRY AGAIN ";
return(0);
}
}
/*********************************************************************
* Function for getting Convicts Record *
*********************************************************************/
void criminal::input(void)
{
clrscr();
this->empty();
criminal x;
int c = 0;
fstream filin;
filin.open("jail.dat”, ios::app|ios::binary);
while(!c)
{
cout<<"n ENTER THE CONVICT CODE : ";
gets(this->conno);
c=x.concheck(this->conno);
}
c=0;
while(!c)
{
cout<<"n ENTER NAME OF CONVICT: ";
gets(this->name);
c=ncheck(this->name);
}
c=0;
while(!c)
{
cout<<"n ENTER SEX: ";
gets(this->sex);
c=s_check(this->sex);
}
cout<<"n ENTER ADDRESS: ";
gets(this->address);
cout<<"n ENTER AGE: ";
gets(this->age);
clrscr();
cout<<"n ENTER DESCRIPTION: nnt ";
c=0;
while(!c)
{
cout<<"nENTER COLOUR: ";
gets(this->des.colour);
c=ncheck(this->des.colour);
}
Criminal Record Software Computer Science Project
9
c=0;
while(!c)
{
cout<<"n FACE DESCRIPTION: ";
gets(this->des.face);
c=ncheck(this->des.face);
}
cout<<"n ENTER HEIGHT(in cm's) : ";
gets(this->des.height);
cout<<"nENTER IDENTIFICATION MARKS (if no distinguishing marks, enter NONE):”;
gets(this->des.imark);
clrscr();
cout<<"ENTER: nntt ";
c=0;
while(!c)
{
cout<<"COURT (from which the prisoner convicted): ";
gets(this->COURT.cour);
c=ncheck(this->COURT.cour);
}
c=0;
while(!c)
{
cout<<"ntt STATE: ";
gets(this->COURT.state);
c= ncheck(this->COURT.state);
}
c=0;
while(!c)
{
cout<<"ntt CRIME : ";
gets(this->COURT.crime);
c= ncheck(this->COURT.crime);
}
cout<<"ntt ACT (under which convicted): ";
gets(this->COURT.act);
clrscr();
cout<<"n ENTER: nntt";
cout<<"ntt COMPLETE ADDRESS OF POLICE STATION: ";
gets(this->POLICE.station);
cout<<"ntt FIR NO. (under which convict was arrested): ";
gets(this->POLICE.fir_no);
cout<<"ntt ENTER DATE OF ARREST(dd/mm/yy):";
c=0;
while(!c)
{
cout<<"nttttt day: ";
cin>>this->POLICE.date_arrest.d;
if((this->POLICE.date_arrest.d>31)||(this->POLICE.date_arrest.d<1))
{
cout<<"nn THIS DATE DOES NOT EXIST, TRY AGAIN!! ";
c=0;
}
Criminal Record Software Computer Science Project
10
else
c=1;
}
c=0;
while(!c)
{
cout<<"nttttt month: ";
cin>>this->POLICE.date_arrest.m;
if((this->POLICE.date_arrest.m>12)||(this->POLICE.date_arrest.m<1))
{
cout<<"nn THIS MONTH DOES NOT EXIST, TRY AGAIN!! ";
c=0;
continue;
}
else
c=1;
if((this->POLICE.date_arrest.d==31) &&((this->POLICE.date_arrest.m==2)
|| (this->POLICE.date_arrest.m==4) ||( this->POLICE.date_arrest.m==6)
||( this->POLICE.date_arrest.m==9) || (this->POLICE.date_arrest.m==11)))
{
cout<<"n THIS MONTH DOES NOT HAVE 31 DAYS n TRY AGAIN!! ";
c=0;
}
else
c=1;
}
c=0;
while(!c)
{
cout<<"nttttt year(in 4 digits): ";
cin>>this->POLICE.date_arrest.y;
if((this->POLICE.date_arrest.y<= 1930)||(this->POLICE.date_arrest.y>2017))
{
cout<<"n INCORRECT INPUT n TRY AGAIN!!n”;
c=0;
}
else
c=1;
}
char ch;
do
{
cout<<"n DO YOU WANT TO SAVE THIS INFORMATION(enter y or n) ";
cin>>ch;
if(ch=='y'||ch=='Y')
{
cout<<"nnt< RECORD HAS BEEN SAVED >";
filin.write((char*)this,sizeof(criminal));
}
else
{
if((ch!='n')&&(ch!='N'))
{
Criminal Record Software Computer Science Project
11
cout<<"n ENTER CORRECTLY n TRY AGAIN!! ";
}
}
} while((ch!='y')&&(ch!='Y')&&(ch!='n')&&(ch!='N'));
filin.close();
}//End of input function
/*********************************************************************
* Function for showing Convict's Record *
*********************************************************************/
void criminal::output()
{
clrscr();
cout<<"@@@@@@@@@@@@@@@@ PERSONAL RECORD OF CONVICT NO @@@@@@@@@@@@@@@@@@@";
cout<<"nnCONVICT NO :t";
puts(conno);
cout<<"nNAME:t";
puts(this->name);
cout<<"nSEX :t"<<this->sex;
cout<<"nnADDRESS :t";
puts(this->address);
cout<<"nAGE :t";
puts(this->age);
cout<<"nnDESCRIPTIONn";
cout<<"n1. COLOUR :t";
puts(this->des.colour);
cout<<"n2. FACE :t";
puts(this->des.face);
cout<<"n3. IDENTIFICATION MARK:t";
puts(this->des.imark);
cout<<"n4. HEIGHT:t";
puts(this->des.height);
cout<<"nnnntttttpress a key to continue....";
getch();
clrscr();
cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ CRIMINAL RECORD @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
cout<<"nnCOURT INFORMATIONnn ";
cout<<"n1. COURT FROM WHICH CONVICTED:t";
puts(this->COURT.cour);
cout<<"n2. STATE:t";
puts(this->COURT.state);
cout<<"n3. CRIME:t";
puts(this->COURT.crime);
cout<<"n4. ACT UNDER WHICH CONVICTED:t";
puts(this->COURT.act);
cout<<"nnnnnntttttt press a key to continue....";
getch();
clrscr();
cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@ CRIMINAL RECORD @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
cout<<"nnnPOLICE INFORMATION nn";
cout<<"n1. FIR NO. :t";
puts(this->POLICE.fir_no);
cout<<"n2. DATE OF ARREST:t"<<this->POLICE.date_arrest.d<<"/"
<<POLICE.date_arrest.m<<"/"<<this->POLICE.date_arrest.y;
Criminal Record Software Computer Science Project
12
cout<<"nn3. POLICE STATION(where fir was lodged):t";
puts(this->POLICE.station);
cout<<"nnnnntttttt press a key to continue....";
getch();
clrscr();
}//end of output function
/*********************************************************************
* Function for Deleting The Record OF A Convict *
*********************************************************************/
void criminal::delete_rec(char con_no[])
{
fstream filin;
filin.open("jail.dat",ios::in|ios::ate);
int q=filin.tellg();
int c=q/sizeof(criminal);
fstream temp;
temp.open("temp.dat",ios::out);
filin.seekg(0,ios::beg);
for(int i=0; i<c; i++)
{
filin.read((char*)this,sizeof(criminal));
if(strcmp(con_no, conno)!=0)
temp.write((char*)this,sizeof(criminal));
}
filin.close();
temp.close();
filin.open("jail.dat",ios::out);
temp.open("temp.dat",ios::in|ios::ate);
int a=temp.tellg();
int size=a/sizeof(criminal);
temp.seekg(0,ios::beg);
for(int k=0;k<size;k++)
{
temp.read((char*)this,sizeof(criminal));
filin.write((char*)this,sizeof(criminal));
}
filin.close();
temp.close();
cout<<"nn < THE RECORD HAS BEEN DELETED >";
}
/*********************************************************************
* Function for checking whether input exists *
*********************************************************************/
int criminal::dcheck(char n[])
{
clrscr();
fstream file;
file.open("jail.dat",ios::in|ios::ate|ios::binary);
int x=0;
int count=0,c;
int q=file.tellg();
c=q/sizeof(criminal);
file.close();
Criminal Record Software Computer Science Project
13
file.open("jail.dat",ios::in|ios::binary);
for(int i=0;i<c;i++)
{
file.read((char*)this,sizeof(criminal));
count++;
if(strcmp(n,conno)==0)
{
x++;
break;
}
}
if(x==0)
{
cout<<"n CONVICT NOT FOUND!! ";
return 0;
}
else
return count;
file.close();
}
//--------------------------------------------------------------------
void criminal::display()
{
clrscr();
char N[10];
int rec;
int loc;
cout<<"n ENTER THE CONVICT CODE OF CONVICT ";
cout<<" WHOSE INFORMATION YOU WANT :";
gets(N);
fstream file;
rec= this->dcheck(N);
file.open("jail.dat",ios::in|ios::binary);
if(rec!=0)
{
loc=(rec-1)*sizeof(criminal);
file.seekg(loc);
file.read((char*)this,sizeof(criminal));
this->output();
}
file.close();
}
//--------------------------------------------------------------------
void criminal::remove()
{
clrscr();
char no[10];int s;
cout<<"n ENTER THE CONVICT NO. OF THE CONVICT WHOSE RECORD YOU WISH TO ";
cout<<"DELETE :" ;
gets(no);
s= this->dcheck(no);
if(s!=0)
this->delete_rec(no);
Criminal Record Software Computer Science Project
14
}
//--------------------------------------------------------------------
int criminal::menu()
{
int ch;
do
{
clrscr();
cout<<"n @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MAIN MENU @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
cout<<"n PRESS:nn";
cout<<"nttt1. TO ADD RECORD/RECORDS ";
cout<<"nttt2. TO MODIFY RECORD/RECORDS ";
cout<<"nttt3. TO DISPLAY RECORD ";
cout<<"nttt4. TO DELETE RECORD ";
cout<<"nttt5. TO LIST ";
cout<<"nttt6. TO QUIT n ";
cin>>ch;
}while((ch!=1)&&(ch!=2)&&(ch!=3)&&(ch!=4)&&(ch!=5)&&(ch!=6));
return(ch);
}
//--------------------------------------------------------------------
void criminal::modify()
{
clrscr();
fstream file ;
char npdr[10], ncrime[10], nact[10], nstate[10], ncourt[10],nstat[10];
char nfir[10];
char str[10],nprd[15],cno[10];
int check,loc;
criminal x;
date D;
cout<<"n MODIFICATION FUNCTION ";
cout<<"nENTER THE CONVICT NUMBER OF THE CONVICT ,TO BE MODIFIED: ";
gets(str);
check=this->dcheck(str);
if(check!=0)
{
file.open("jail.dat",ios::out|ios::ate);
int d=0;
while(!d)
{
cout<<"n ENTER THE MODIFIED CONVICT NO :";
gets(cno);
d= x.concheck(cno);
}
strcpy(conno,cno);
cout<<"n ENTER THE MODIFIED CRIME :";
gets(ncrime);
strcpy(COURT.crime,ncrime);
cout<<"n ENTER THE MODIFIED COURT RECORD: ";
cout<<"n ACT :";
gets(nact);
strcpy(COURT.act,nact);
Criminal Record Software Computer Science Project
15
cout<<"nSTATE : ";
gets(nstate);
strcpy(COURT.state,nstate);
cout<<"nCOURT : ";
gets(ncourt);
strcpy(COURT.cour,ncourt);
clrscr();
cout<<"n ENTER THE MODIFIED POLICE RECORD ";
cout<<"n STATION : ";
gets(nstat);
strcpy(POLICE.station,nstat);
cout<<"nFIR NO : ";
gets(nfir);
strcpy(POLICE.fir_no,nfir);
cout<<"n DATE OF ARREST(dd,mm,yyyy) ";
int c=0;
while(!c)
{
cout<<"nttttt day : ";
cin>>D.d;
if((D.d>31)||(D.d<1))
{
cout<<"nn THIS DATE DOES NOT EXIST,TRY AGAIN!! ";
c=0;
}
else
c=1;
}
c=0;
while(!c)
{
cout<<"nttttt month : ";
cin>>D.m;
if((D.m>12)||(D.m<1))
{
cout<<"nn THIS MONTH DOES NOT EXIST,TRY AGAIN!! ";
c=0;
continue;
}
else
c=1;
if((D.d==31)&&((D.m==2)||(D.m==4)||( D.m==6)||( D.m==9)||(D.m==11)))
{
cout<<"n THIS MONTH DOES NOT HAVE 31 DAYS n TRY AGAIN!!";
c=0;
}
else
c=1;
}
c=0;
while(!c)
{
cout<<"nttttt year(in 4 digits) : ";
Criminal Record Software Computer Science Project
16
cin>>D.y;
if((D.y <= 1930)||(D.y>2018) )
{
cout<<"n INCORRECT INPUT n TRY AGAIN!!n" ;
c=0;
}
else
c=1;
}
POLICE.date_arrest.d=D.d;
POLICE.date_arrest.m=D.m;
POLICE.date_arrest.y=D.y;
loc=(check-1)*sizeof(criminal);
file.seekp(loc);
file.write((char*)this,sizeof(criminal));
file.close();
}
}
//--------------------------------------------------------------------
void criminal::list()
{
clrscr();
int j ;
fstream file;
file.open("jail.dat",ios::in|ios::ate|ios::binary);
int q=file.tellg();
int c=q/sizeof(criminal);
file.seekg(0);
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" CONVICT LIST "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<"n==================================================="<<endl;
cout<<"SNOtNAMEtttCONVICT NO.tttCRIME"<<endl;
cout<<"====================================================="<<endl;
int i=0;
while(file.read((char*)this,sizeof(criminal)))
{
i++;
cout<<i<<" ";
for( j=0;j<strlen(this->name);j++)
cout<<this->name[j];
cout<<"ttt ";
for(j=0;j<strlen(this->conno);j++)
cout<<this->conno[j];
cout<<"ttt ";
for(j=0;j<strlen(this->COURT.crime);j++)
cout<<this->COURT.crime[j];
cout<<"n----------------------------------------------------n";
if((i%3)==0&&(i!=c))
{
cout<<"Press a key to continue...........";
Criminal Record Software Computer Science Project
17
getch();
clrscr();
cout<<"n==========================================="<<endl;
cout<<"SNOtNAMEtttCONVICT NO.tttCRIME"<<endl;
cout<<"============================================="<<endl;
}
}
file.close();
}
//--------------------------------------------------------------------
void criminal::empty()
{
int i;
for(i=0;i<20;i++)
name[i]=' ';
for(i=0;i<10;i++)
conno[i]=' ';
for(i=0;i<3;i++)
sex[i]=' ';
for(i=0;i<4;i++)
age[i]=' ';
for(i=0;i<50;i++)
address[i]=' ';
for(i=0;i<20;i++)
COURT.cour[i]=' ';
for(i=0;i<20;i++)
COURT.crime[i]=' ';
for(i=0;i<20;i++)
COURT.act[i]=' ';
for(i=0;i<20;i++)
COURT.state[i]=' ';
for(i=0;i<20;i++)
des.colour[i]=' ';
for(i=0;i<20;i++)
des.imark[i]=' ';
for(i=0;i<20;i++)
des.face[i]=' ';
for(i=0;i<6;i++)
des.height[i]=' ';
for(i=0;i<50;i++)
POLICE.station[i]=' ';
for(i=0;i<10;i++)
POLICE.fir_no[i]=' ';
POLICE.date_arrest.m = 0;
POLICE.date_arrest.d = 0;
POLICE.date_arrest.y = 0;
}
//--------------------------------------------------------------------
int criminal::concheck(char b[])
{
fstream file;
char a[10];
int check=0;
Criminal Record Software Computer Science Project
18
file.open("jail.dat",ios::in|ios::ate);
int q=file.tellg();
int size=q/sizeof(criminal);
file.seekg(0,ios::beg);
for(int i=0;i<size;i++)
{
file.read((char*)this,sizeof(criminal));
strcpy(a,conno);
if(strcmp(b,a)==0)
{
check+=1;
break;
}
}
if(check==0)
{return(10);}
else
{
cout<<"n GIVEN CONVICT CODE ALREADY EXISTS!! "<<endl;
return(0);
}
file.close();
}
void main()
{
clrscr();
int x;
for(int i=0; i<3; i++)
{
clrscr();
cout<<"nCRIMINAL RECORD.nnttt<by Aryan Varshneya>nnnttt";
cout<<"ENTER PASSWORD.";
char *pass;
cin>>pass;
x=strcmp(pass,"123");
if(x==0)
{
break;
}
else
{
cout<<"a";
}
}
if(x==0)
{
int choice, ans='y';
criminal l;
while((ans=='y'|| ans=='Y'))
{
choice= l.menu();
switch(choice)
{
Criminal Record Software Computer Science Project
19
case 1: l.input();
break;
case 2: l.modify();
break;
case 3: l.display();
break;
case 4: l.remove();
break;
case 5: l.list();
break;
case 6: exit(0);
}
cout<<"nnnDO YOU WANT TO CONTINUE(press y to continue)..";
ans=getch();
if(ans=='y'||ans=='Y')
continue;
}
}
}
Output
Criminal Record Software Computer Science Project
20
Criminal Record Software Computer Science Project
21
Criminal Record Software Computer Science Project
22
Criminal Record Software Computer Science Project
23
Criminal Record Software Computer Science Project
24
Criminal Record Software Computer Science Project
25
Criminal Record Software Computer Science Project
26
Criminal Record Software Computer Science Project
27
Criminal Record Software Computer Science Project
28
Criminal Record Software Computer Science Project
29
Criminal Record Software Computer Science Project
30
Criminal Record Software Computer Science Project
31
Criminal Record Software Computer Science Project
32
Bibliography
BOOKS:
Computer Science with C++ by Sumita
Arora
Object Oriented Programming with C++
by E Balagurusamy
INTERNET:
www.icbse.com
www.cbseportal.com
www.c++projects.com
Criminal Record Software Computer Science Project
33

More Related Content

What's hot

Python an-intro v2
Python an-intro v2Python an-intro v2
Python an-intro v2
Arulalan T
 

What's hot (20)

REPORT ON ASP.NET
REPORT ON ASP.NETREPORT ON ASP.NET
REPORT ON ASP.NET
 
Basic Concepts in Python
Basic Concepts in PythonBasic Concepts in Python
Basic Concepts in Python
 
Data file handling
Data file handlingData file handling
Data file handling
 
Python projects
Python projectsPython projects
Python projects
 
Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)
Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)
Computer Investgatort Project (HOTEL MANAGEMENT SYSTEM)
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Python regular expressions
Python regular expressionsPython regular expressions
Python regular expressions
 
Xi CBSE Computer Science lab programs
Xi CBSE Computer Science lab programsXi CBSE Computer Science lab programs
Xi CBSE Computer Science lab programs
 
Telephone directory
Telephone directoryTelephone directory
Telephone directory
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandas
 
Chapter 15 Lists
Chapter 15 ListsChapter 15 Lists
Chapter 15 Lists
 
PYTHON PPT.pptx
PYTHON PPT.pptxPYTHON PPT.pptx
PYTHON PPT.pptx
 
Chapter 03 python libraries
Chapter 03 python librariesChapter 03 python libraries
Chapter 03 python libraries
 
VB net lab.pdf
VB net lab.pdfVB net lab.pdf
VB net lab.pdf
 
Python ppt
Python pptPython ppt
Python ppt
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xii
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Ip library management project
Ip library management projectIp library management project
Ip library management project
 
Python an-intro v2
Python an-intro v2Python an-intro v2
Python an-intro v2
 
Synopsis tic tac toe
Synopsis tic tac toeSynopsis tic tac toe
Synopsis tic tac toe
 

Similar to Criminal Record System

Working with the IFS on System i
Working with the IFS on System iWorking with the IFS on System i
Working with the IFS on System i
Chuck Walker
 
Runtime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya RathoreRuntime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya Rathore
Esha Yadav
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packages
Ajay Ohri
 
Lex tool manual
Lex tool manualLex tool manual
Lex tool manual
Sami Said
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
sean chen
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02
Wei Sun
 

Similar to Criminal Record System (20)

Working with the IFS on System i
Working with the IFS on System iWorking with the IFS on System i
Working with the IFS on System i
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
Intrusion Discovery on Windows
Intrusion Discovery on WindowsIntrusion Discovery on Windows
Intrusion Discovery on Windows
 
Activity 5
Activity 5Activity 5
Activity 5
 
powershell-is-dead-epic-learnings-london
powershell-is-dead-epic-learnings-londonpowershell-is-dead-epic-learnings-london
powershell-is-dead-epic-learnings-london
 
Hack an ASP .NET website? Hard, but possible!
Hack an ASP .NET website? Hard, but possible! Hack an ASP .NET website? Hard, but possible!
Hack an ASP .NET website? Hard, but possible!
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical file
 
Runtime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya RathoreRuntime Environment Of .Net Divya Rathore
Runtime Environment Of .Net Divya Rathore
 
Fuzz
FuzzFuzz
Fuzz
 
Os lab final
Os lab finalOs lab final
Os lab final
 
source code which create file and write into it
source code which create file and write into itsource code which create file and write into it
source code which create file and write into it
 
r,rstats,r language,r packages
r,rstats,r language,r packagesr,rstats,r language,r packages
r,rstats,r language,r packages
 
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentationMacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
 
Usp notes
Usp notesUsp notes
Usp notes
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
 
Lex tool manual
Lex tool manualLex tool manual
Lex tool manual
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
Unix system programming
Unix system programmingUnix system programming
Unix system programming
 
OS_lab_file.pdf
OS_lab_file.pdfOS_lab_file.pdf
OS_lab_file.pdf
 
Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02Dotnetintroduce 100324201546-phpapp02
Dotnetintroduce 100324201546-phpapp02
 

More from Cool Guy

More from Cool Guy (8)

Module 2 Design Analysis and Algorithms
Module 2 Design Analysis and AlgorithmsModule 2 Design Analysis and Algorithms
Module 2 Design Analysis and Algorithms
 
OPTIMAL BINARY SEARCH
OPTIMAL BINARY SEARCHOPTIMAL BINARY SEARCH
OPTIMAL BINARY SEARCH
 
Modified Distribution Method (MODI)
Modified Distribution Method (MODI)Modified Distribution Method (MODI)
Modified Distribution Method (MODI)
 
Class 12 Maths Board Syllabus CBSE 2018
Class 12 Maths Board Syllabus CBSE 2018Class 12 Maths Board Syllabus CBSE 2018
Class 12 Maths Board Syllabus CBSE 2018
 
Infrared Security System
Infrared Security SystemInfrared Security System
Infrared Security System
 
The Preparation Of Potash Alum
The Preparation Of Potash AlumThe Preparation Of Potash Alum
The Preparation Of Potash Alum
 
Soil pollution
Soil pollutionSoil pollution
Soil pollution
 
Software concepts
Software conceptsSoftware concepts
Software concepts
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Recently uploaded (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 

Criminal Record System

  • 1. 1 COMPUTER SCIENCE PROJECT Criminal Record software NAME : Aryan Varshneya CLASS : XII -A1 ROLL NO. : 04 Index
  • 2. Criminal Record Software Computer Science Project 2 1. Acknowledgement 2. Certificate 3. Introduction 4. Aim 5. Program Code 6. Output 7. Bibliography
  • 3. 3 Introduction  C++ is designed with a bias toward system programming (e.g., for use in embedded systems or operating system kernels), with performance, efficiency and flexibility of use as its design requirements. C++ has also been found useful in many other contexts, including desktop applications, servers (e.g. e- commerce, web search or SQL servers), performance-critical applications (e.g. telephone switches or space probes), and entertainment software. C++ is a compiled language, with implementations of it available on many platforms and provided by various organizations, including the FSF, LLVM, Microsoft and Intel.  C++ is standardized by the International Organization for Standardization (ISO), with the latest (and current) standard version ratified and published by ISO in September 2011 as ISO/IEC 14882:2011 (informally known as C++11). The C++ programming language was initially standardised in 1998 as ISO/IEC 14882:1998, which was then amended by the C++03, ISO/IEC 14882:2003, standard. The current C++11 standard supersedes these, with new features and an enlarged standard library. Before the initial standardization in 1998, C++ was developed by Bjarne Stroustrup at Bell Labs, starting in 1979, who wanted an efficient flexible language (like the C language), which also provided high-level features for program organization.  Function: - A function is a group of statements that together perform a task. o Every C++ program has at least one function, which is main(), and all the most trivial programs can define additional functions. o A function declaration tells the compiler about a function's name, return type, and parameters. o A function definition provides the actual body of the function. o The C++ standard library provides numerous built-in functions that your program can call. For example, function strcat() to concatenate two strings, function memcpy() to copy one memory location to another location and many more functions.
  • 4. Criminal Record Software Computer Science Project 4  Class: - A class is a user defined type or data structure declared with keyword class that has data and functions (also called methods) as its members whose access is governed by the three access specifiers private, protected or public (by default access to members of a class is private). A class (declared with keyword class) in C++ differs from a structure (declared with keyword struct) as by default, members are private in a class while they are public in a structure. The private members are not accessible outside the class; they can be accessed only through methods of the class.  Data FILE HANDLING: - The fstream library predefines a set of operations for handling file related input and output. It defines certain classes that help one perform file input and output. For ex, ifstream class ties a file to the program for input; ofstream class ties a file to the program for output; and fstream class ties a file to the program for both input and output. Aim This program is used to keep details of criminal’s in a police station.
  • 5. Criminal Record Software Computer Science Project 5 This program consists of FIVE options as follows: - 1. TO ADD RECORD/RECORDS 2. TO MODIFY RECORD/RECORDS 3. TO DISPLAY RECORD 4. TO DELETE RECORD 5. TO show LIST 6. TO QUIT Program Code #include<iostream.h>
  • 6. Criminal Record Software Computer Science Project 6 #include<conio.h> #include<stdio.h> #include<fstream.h> #include<string.h> #include<stdlib.h> #include<iomanip.h> /********************************************************************* * Structure for Date * *********************************************************************/ struct date { int d; int m; int y; }; /********************************************************************* * Structure for Details of Crime of Criminal * *********************************************************************/ struct court { char crime[20]; char act[20]; char cour[20]; char state[20]; }; /********************************************************************* * Structure for Physical Description of Criminal * *********************************************************************/ struct descp { char colour[20]; char face[20]; char imark[20]; //IDENTIFICATION MARKS (DEFORMITIES ETC.) char height[6]; }; /********************************************************************* * Structure for Details of F.I.R. * *********************************************************************/ struct police { char station[50]; char fir_no[10]; date date_arrest; }; /********************************************************************* * Class ' CRIMINAL ' for getting all information about Convict* *********************************************************************/ class criminal { char name[20]; char sex[3]; char conno[10];
  • 7. Criminal Record Software Computer Science Project 7 char age[4]; char address[50]; //ADDRESS OF CRIMINAL BEFORE ARREST. court COURT; police POLICE; descp des; public: int ncheck(char arr[]); // FUNCTION TO CHECK THAT INPUT IS NOT NUMERIC. int s_check(char a[]); // FUNCTION TO CHECK THAT THE INPUT FOR // SEX HAS ONLY 1 CHARACTER IN M OR F ONLY void input(void); void output(void); void delete_rec(char con_no[]); int dcheck(char n[]); void display(); void remove(); int menu(); void modify(); void list(); void empty(); int concheck(char b[]); }; // ====================>End of Class Criminal<======================== /********************************************************************* * Function for Checking Whether Input is Correct * *********************************************************************/ int criminal::ncheck(char arr[]) { int i=0; while (arr[i]!='0') { if(((arr[i]>64)&&(arr[i]<92))||((arr[i]>95)&&(arr[i]<124))||(arr[i]==' ')) { i++; continue; } else { cout<<"nINCORRECT INPUT. TRY AGAIN !!n "; return 0; } } return 1; } /********************************************************************* * Function to Check whether Sex is Given Correctly * *********************************************************************/ int criminal::s_check(char a[]) { clrscr(); if(((a[0]=='m')||(a[0]=='f')||(a[0]=='M')||(a[0]=='F'))&&(a[1]=='0')) {
  • 8. Criminal Record Software Computer Science Project 8 return(1); } else { cout<<"n INCORRECT INPUT ,TRY AGAIN "; return(0); } } /********************************************************************* * Function for getting Convicts Record * *********************************************************************/ void criminal::input(void) { clrscr(); this->empty(); criminal x; int c = 0; fstream filin; filin.open("jail.dat”, ios::app|ios::binary); while(!c) { cout<<"n ENTER THE CONVICT CODE : "; gets(this->conno); c=x.concheck(this->conno); } c=0; while(!c) { cout<<"n ENTER NAME OF CONVICT: "; gets(this->name); c=ncheck(this->name); } c=0; while(!c) { cout<<"n ENTER SEX: "; gets(this->sex); c=s_check(this->sex); } cout<<"n ENTER ADDRESS: "; gets(this->address); cout<<"n ENTER AGE: "; gets(this->age); clrscr(); cout<<"n ENTER DESCRIPTION: nnt "; c=0; while(!c) { cout<<"nENTER COLOUR: "; gets(this->des.colour); c=ncheck(this->des.colour); }
  • 9. Criminal Record Software Computer Science Project 9 c=0; while(!c) { cout<<"n FACE DESCRIPTION: "; gets(this->des.face); c=ncheck(this->des.face); } cout<<"n ENTER HEIGHT(in cm's) : "; gets(this->des.height); cout<<"nENTER IDENTIFICATION MARKS (if no distinguishing marks, enter NONE):”; gets(this->des.imark); clrscr(); cout<<"ENTER: nntt "; c=0; while(!c) { cout<<"COURT (from which the prisoner convicted): "; gets(this->COURT.cour); c=ncheck(this->COURT.cour); } c=0; while(!c) { cout<<"ntt STATE: "; gets(this->COURT.state); c= ncheck(this->COURT.state); } c=0; while(!c) { cout<<"ntt CRIME : "; gets(this->COURT.crime); c= ncheck(this->COURT.crime); } cout<<"ntt ACT (under which convicted): "; gets(this->COURT.act); clrscr(); cout<<"n ENTER: nntt"; cout<<"ntt COMPLETE ADDRESS OF POLICE STATION: "; gets(this->POLICE.station); cout<<"ntt FIR NO. (under which convict was arrested): "; gets(this->POLICE.fir_no); cout<<"ntt ENTER DATE OF ARREST(dd/mm/yy):"; c=0; while(!c) { cout<<"nttttt day: "; cin>>this->POLICE.date_arrest.d; if((this->POLICE.date_arrest.d>31)||(this->POLICE.date_arrest.d<1)) { cout<<"nn THIS DATE DOES NOT EXIST, TRY AGAIN!! "; c=0; }
  • 10. Criminal Record Software Computer Science Project 10 else c=1; } c=0; while(!c) { cout<<"nttttt month: "; cin>>this->POLICE.date_arrest.m; if((this->POLICE.date_arrest.m>12)||(this->POLICE.date_arrest.m<1)) { cout<<"nn THIS MONTH DOES NOT EXIST, TRY AGAIN!! "; c=0; continue; } else c=1; if((this->POLICE.date_arrest.d==31) &&((this->POLICE.date_arrest.m==2) || (this->POLICE.date_arrest.m==4) ||( this->POLICE.date_arrest.m==6) ||( this->POLICE.date_arrest.m==9) || (this->POLICE.date_arrest.m==11))) { cout<<"n THIS MONTH DOES NOT HAVE 31 DAYS n TRY AGAIN!! "; c=0; } else c=1; } c=0; while(!c) { cout<<"nttttt year(in 4 digits): "; cin>>this->POLICE.date_arrest.y; if((this->POLICE.date_arrest.y<= 1930)||(this->POLICE.date_arrest.y>2017)) { cout<<"n INCORRECT INPUT n TRY AGAIN!!n”; c=0; } else c=1; } char ch; do { cout<<"n DO YOU WANT TO SAVE THIS INFORMATION(enter y or n) "; cin>>ch; if(ch=='y'||ch=='Y') { cout<<"nnt< RECORD HAS BEEN SAVED >"; filin.write((char*)this,sizeof(criminal)); } else { if((ch!='n')&&(ch!='N')) {
  • 11. Criminal Record Software Computer Science Project 11 cout<<"n ENTER CORRECTLY n TRY AGAIN!! "; } } } while((ch!='y')&&(ch!='Y')&&(ch!='n')&&(ch!='N')); filin.close(); }//End of input function /********************************************************************* * Function for showing Convict's Record * *********************************************************************/ void criminal::output() { clrscr(); cout<<"@@@@@@@@@@@@@@@@ PERSONAL RECORD OF CONVICT NO @@@@@@@@@@@@@@@@@@@"; cout<<"nnCONVICT NO :t"; puts(conno); cout<<"nNAME:t"; puts(this->name); cout<<"nSEX :t"<<this->sex; cout<<"nnADDRESS :t"; puts(this->address); cout<<"nAGE :t"; puts(this->age); cout<<"nnDESCRIPTIONn"; cout<<"n1. COLOUR :t"; puts(this->des.colour); cout<<"n2. FACE :t"; puts(this->des.face); cout<<"n3. IDENTIFICATION MARK:t"; puts(this->des.imark); cout<<"n4. HEIGHT:t"; puts(this->des.height); cout<<"nnnntttttpress a key to continue...."; getch(); clrscr(); cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ CRIMINAL RECORD @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; cout<<"nnCOURT INFORMATIONnn "; cout<<"n1. COURT FROM WHICH CONVICTED:t"; puts(this->COURT.cour); cout<<"n2. STATE:t"; puts(this->COURT.state); cout<<"n3. CRIME:t"; puts(this->COURT.crime); cout<<"n4. ACT UNDER WHICH CONVICTED:t"; puts(this->COURT.act); cout<<"nnnnnntttttt press a key to continue...."; getch(); clrscr(); cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@ CRIMINAL RECORD @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; cout<<"nnnPOLICE INFORMATION nn"; cout<<"n1. FIR NO. :t"; puts(this->POLICE.fir_no); cout<<"n2. DATE OF ARREST:t"<<this->POLICE.date_arrest.d<<"/" <<POLICE.date_arrest.m<<"/"<<this->POLICE.date_arrest.y;
  • 12. Criminal Record Software Computer Science Project 12 cout<<"nn3. POLICE STATION(where fir was lodged):t"; puts(this->POLICE.station); cout<<"nnnnntttttt press a key to continue...."; getch(); clrscr(); }//end of output function /********************************************************************* * Function for Deleting The Record OF A Convict * *********************************************************************/ void criminal::delete_rec(char con_no[]) { fstream filin; filin.open("jail.dat",ios::in|ios::ate); int q=filin.tellg(); int c=q/sizeof(criminal); fstream temp; temp.open("temp.dat",ios::out); filin.seekg(0,ios::beg); for(int i=0; i<c; i++) { filin.read((char*)this,sizeof(criminal)); if(strcmp(con_no, conno)!=0) temp.write((char*)this,sizeof(criminal)); } filin.close(); temp.close(); filin.open("jail.dat",ios::out); temp.open("temp.dat",ios::in|ios::ate); int a=temp.tellg(); int size=a/sizeof(criminal); temp.seekg(0,ios::beg); for(int k=0;k<size;k++) { temp.read((char*)this,sizeof(criminal)); filin.write((char*)this,sizeof(criminal)); } filin.close(); temp.close(); cout<<"nn < THE RECORD HAS BEEN DELETED >"; } /********************************************************************* * Function for checking whether input exists * *********************************************************************/ int criminal::dcheck(char n[]) { clrscr(); fstream file; file.open("jail.dat",ios::in|ios::ate|ios::binary); int x=0; int count=0,c; int q=file.tellg(); c=q/sizeof(criminal); file.close();
  • 13. Criminal Record Software Computer Science Project 13 file.open("jail.dat",ios::in|ios::binary); for(int i=0;i<c;i++) { file.read((char*)this,sizeof(criminal)); count++; if(strcmp(n,conno)==0) { x++; break; } } if(x==0) { cout<<"n CONVICT NOT FOUND!! "; return 0; } else return count; file.close(); } //-------------------------------------------------------------------- void criminal::display() { clrscr(); char N[10]; int rec; int loc; cout<<"n ENTER THE CONVICT CODE OF CONVICT "; cout<<" WHOSE INFORMATION YOU WANT :"; gets(N); fstream file; rec= this->dcheck(N); file.open("jail.dat",ios::in|ios::binary); if(rec!=0) { loc=(rec-1)*sizeof(criminal); file.seekg(loc); file.read((char*)this,sizeof(criminal)); this->output(); } file.close(); } //-------------------------------------------------------------------- void criminal::remove() { clrscr(); char no[10];int s; cout<<"n ENTER THE CONVICT NO. OF THE CONVICT WHOSE RECORD YOU WISH TO "; cout<<"DELETE :" ; gets(no); s= this->dcheck(no); if(s!=0) this->delete_rec(no);
  • 14. Criminal Record Software Computer Science Project 14 } //-------------------------------------------------------------------- int criminal::menu() { int ch; do { clrscr(); cout<<"n @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ MAIN MENU @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; cout<<"n PRESS:nn"; cout<<"nttt1. TO ADD RECORD/RECORDS "; cout<<"nttt2. TO MODIFY RECORD/RECORDS "; cout<<"nttt3. TO DISPLAY RECORD "; cout<<"nttt4. TO DELETE RECORD "; cout<<"nttt5. TO LIST "; cout<<"nttt6. TO QUIT n "; cin>>ch; }while((ch!=1)&&(ch!=2)&&(ch!=3)&&(ch!=4)&&(ch!=5)&&(ch!=6)); return(ch); } //-------------------------------------------------------------------- void criminal::modify() { clrscr(); fstream file ; char npdr[10], ncrime[10], nact[10], nstate[10], ncourt[10],nstat[10]; char nfir[10]; char str[10],nprd[15],cno[10]; int check,loc; criminal x; date D; cout<<"n MODIFICATION FUNCTION "; cout<<"nENTER THE CONVICT NUMBER OF THE CONVICT ,TO BE MODIFIED: "; gets(str); check=this->dcheck(str); if(check!=0) { file.open("jail.dat",ios::out|ios::ate); int d=0; while(!d) { cout<<"n ENTER THE MODIFIED CONVICT NO :"; gets(cno); d= x.concheck(cno); } strcpy(conno,cno); cout<<"n ENTER THE MODIFIED CRIME :"; gets(ncrime); strcpy(COURT.crime,ncrime); cout<<"n ENTER THE MODIFIED COURT RECORD: "; cout<<"n ACT :"; gets(nact); strcpy(COURT.act,nact);
  • 15. Criminal Record Software Computer Science Project 15 cout<<"nSTATE : "; gets(nstate); strcpy(COURT.state,nstate); cout<<"nCOURT : "; gets(ncourt); strcpy(COURT.cour,ncourt); clrscr(); cout<<"n ENTER THE MODIFIED POLICE RECORD "; cout<<"n STATION : "; gets(nstat); strcpy(POLICE.station,nstat); cout<<"nFIR NO : "; gets(nfir); strcpy(POLICE.fir_no,nfir); cout<<"n DATE OF ARREST(dd,mm,yyyy) "; int c=0; while(!c) { cout<<"nttttt day : "; cin>>D.d; if((D.d>31)||(D.d<1)) { cout<<"nn THIS DATE DOES NOT EXIST,TRY AGAIN!! "; c=0; } else c=1; } c=0; while(!c) { cout<<"nttttt month : "; cin>>D.m; if((D.m>12)||(D.m<1)) { cout<<"nn THIS MONTH DOES NOT EXIST,TRY AGAIN!! "; c=0; continue; } else c=1; if((D.d==31)&&((D.m==2)||(D.m==4)||( D.m==6)||( D.m==9)||(D.m==11))) { cout<<"n THIS MONTH DOES NOT HAVE 31 DAYS n TRY AGAIN!!"; c=0; } else c=1; } c=0; while(!c) { cout<<"nttttt year(in 4 digits) : ";
  • 16. Criminal Record Software Computer Science Project 16 cin>>D.y; if((D.y <= 1930)||(D.y>2018) ) { cout<<"n INCORRECT INPUT n TRY AGAIN!!n" ; c=0; } else c=1; } POLICE.date_arrest.d=D.d; POLICE.date_arrest.m=D.m; POLICE.date_arrest.y=D.y; loc=(check-1)*sizeof(criminal); file.seekp(loc); file.write((char*)this,sizeof(criminal)); file.close(); } } //-------------------------------------------------------------------- void criminal::list() { clrscr(); int j ; fstream file; file.open("jail.dat",ios::in|ios::ate|ios::binary); int q=file.tellg(); int c=q/sizeof(criminal); file.seekg(0); cout<<" "<<endl; cout<<" "<<endl; cout<<" CONVICT LIST "<<endl; cout<<" "<<endl; cout<<" "<<endl; cout<<"n==================================================="<<endl; cout<<"SNOtNAMEtttCONVICT NO.tttCRIME"<<endl; cout<<"====================================================="<<endl; int i=0; while(file.read((char*)this,sizeof(criminal))) { i++; cout<<i<<" "; for( j=0;j<strlen(this->name);j++) cout<<this->name[j]; cout<<"ttt "; for(j=0;j<strlen(this->conno);j++) cout<<this->conno[j]; cout<<"ttt "; for(j=0;j<strlen(this->COURT.crime);j++) cout<<this->COURT.crime[j]; cout<<"n----------------------------------------------------n"; if((i%3)==0&&(i!=c)) { cout<<"Press a key to continue...........";
  • 17. Criminal Record Software Computer Science Project 17 getch(); clrscr(); cout<<"n==========================================="<<endl; cout<<"SNOtNAMEtttCONVICT NO.tttCRIME"<<endl; cout<<"============================================="<<endl; } } file.close(); } //-------------------------------------------------------------------- void criminal::empty() { int i; for(i=0;i<20;i++) name[i]=' '; for(i=0;i<10;i++) conno[i]=' '; for(i=0;i<3;i++) sex[i]=' '; for(i=0;i<4;i++) age[i]=' '; for(i=0;i<50;i++) address[i]=' '; for(i=0;i<20;i++) COURT.cour[i]=' '; for(i=0;i<20;i++) COURT.crime[i]=' '; for(i=0;i<20;i++) COURT.act[i]=' '; for(i=0;i<20;i++) COURT.state[i]=' '; for(i=0;i<20;i++) des.colour[i]=' '; for(i=0;i<20;i++) des.imark[i]=' '; for(i=0;i<20;i++) des.face[i]=' '; for(i=0;i<6;i++) des.height[i]=' '; for(i=0;i<50;i++) POLICE.station[i]=' '; for(i=0;i<10;i++) POLICE.fir_no[i]=' '; POLICE.date_arrest.m = 0; POLICE.date_arrest.d = 0; POLICE.date_arrest.y = 0; } //-------------------------------------------------------------------- int criminal::concheck(char b[]) { fstream file; char a[10]; int check=0;
  • 18. Criminal Record Software Computer Science Project 18 file.open("jail.dat",ios::in|ios::ate); int q=file.tellg(); int size=q/sizeof(criminal); file.seekg(0,ios::beg); for(int i=0;i<size;i++) { file.read((char*)this,sizeof(criminal)); strcpy(a,conno); if(strcmp(b,a)==0) { check+=1; break; } } if(check==0) {return(10);} else { cout<<"n GIVEN CONVICT CODE ALREADY EXISTS!! "<<endl; return(0); } file.close(); } void main() { clrscr(); int x; for(int i=0; i<3; i++) { clrscr(); cout<<"nCRIMINAL RECORD.nnttt<by Aryan Varshneya>nnnttt"; cout<<"ENTER PASSWORD."; char *pass; cin>>pass; x=strcmp(pass,"123"); if(x==0) { break; } else { cout<<"a"; } } if(x==0) { int choice, ans='y'; criminal l; while((ans=='y'|| ans=='Y')) { choice= l.menu(); switch(choice) {
  • 19. Criminal Record Software Computer Science Project 19 case 1: l.input(); break; case 2: l.modify(); break; case 3: l.display(); break; case 4: l.remove(); break; case 5: l.list(); break; case 6: exit(0); } cout<<"nnnDO YOU WANT TO CONTINUE(press y to continue).."; ans=getch(); if(ans=='y'||ans=='Y') continue; } } } Output
  • 20. Criminal Record Software Computer Science Project 20
  • 21. Criminal Record Software Computer Science Project 21
  • 22. Criminal Record Software Computer Science Project 22
  • 23. Criminal Record Software Computer Science Project 23
  • 24. Criminal Record Software Computer Science Project 24
  • 25. Criminal Record Software Computer Science Project 25
  • 26. Criminal Record Software Computer Science Project 26
  • 27. Criminal Record Software Computer Science Project 27
  • 28. Criminal Record Software Computer Science Project 28
  • 29. Criminal Record Software Computer Science Project 29
  • 30. Criminal Record Software Computer Science Project 30
  • 31. Criminal Record Software Computer Science Project 31
  • 32. Criminal Record Software Computer Science Project 32 Bibliography BOOKS: Computer Science with C++ by Sumita Arora Object Oriented Programming with C++ by E Balagurusamy INTERNET: www.icbse.com www.cbseportal.com www.c++projects.com
  • 33. Criminal Record Software Computer Science Project 33