0% found this document useful (0 votes)
4 views

jatin thakur project

The document outlines a project on a Police FIR Record Management System developed in C++ for managing FIRs digitally. It includes functionalities for filing new FIRs, viewing all records, and searching FIRs by number, with data stored in a text file. The source code demonstrates the use of file handling and structures in C++.

Uploaded by

Sagar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

jatin thakur project

The document outlines a project on a Police FIR Record Management System developed in C++ for managing FIRs digitally. It includes functionalities for filing new FIRs, viewing all records, and searching FIRs by number, with data stored in a text file. The source code demonstrates the use of file handling and structures in C++.

Uploaded by

Sagar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PROJECT

ON
TOPIC
POLICE FIR RECORD MANAGEMENT
FOR THE
SUBJECT
OF
OOP USING C++ (UGCA 1910)

SUBMITTED TO SUBMITTED BY

Ms. PRATIBHA SORAM JATIN THAKUR


Assistant Professor 2445465
CSE Department BCA 1E 2nd Sem
Introduction-

The Police FIR Record Management System is a basic C++ project designed to help
manage FIRs digitally. It allows users to file new FIRs, view all records, and search
FIRs by number. The data is stored in a text file for easy access and retrieval. This
system improves record-keeping and demonstrates the use of file handling and
structures in C++.

SOURCE CODE –

include <iostream>
#include <fstream>
#include <string>
using namespace std;

struct FIR {
int firNumber;
string name;
string address;
string crimeType;
string date;
};

void fileFIR() {
FIR fir;
ofstream outFile("fir_records.txt", ios::app); // append mode

cout << "\n--- File a New FIR ---\n";


cout << "Enter FIR Number: ";
cin >> fir.firNumber;
cin.ignore(); // to clear newline character
cout << "Enter Name: ";
getline(cin, fir.name);
cout << "Enter Address: ";
getline(cin, fir.address);
cout << "Enter Type of Crime: ";
getline(cin, fir.crimeType);
cout << "Enter Date (dd-mm-yyyy): ";
getline(cin, fir.date);

// Writing to file
outFile << fir.firNumber << '|'
<< fir.name << '|'
<< fir.address << '|'
<< fir.crimeType << '|'
<< fir.date << '\n';

outFile.close();
cout << "FIR filed successfully!\n";
}

void viewAllFIRs() {
ifstream inFile("fir_records.txt");
string line;

cout << "\n--- All FIR Records ---\n";


while (getline(inFile, line)) {
stringstream ss(line);
string firNo, name, address, crime, date;

getline(ss, firNo, '|');


getline(ss, name, '|');
getline(ss, address, '|');
getline(ss, crime, '|');
getline(ss, date, '|');

cout << "\nFIR Number: " << firNo


<< "\nName: " << name
<< "\nAddress: " << address
<< "\nCrime Type: " << crime
<< "\nDate: " << date << "\n";
}

inFile.close();
}

void searchFIR() {
ifstream inFile("fir_records.txt");
string line;
int searchNumber;
bool found = false;

cout << "\nEnter FIR Number to search: ";


cin >> searchNumber;

while (getline(inFile, line)) {


stringstream ss(line);
string firNoStr, name, address, crime, date;

getline(ss, firNoStr, '|');


int firNo = stoi(firNoStr);

if (firNo == searchNumber) {
getline(ss, name, '|');
getline(ss, address, '|');
getline(ss, crime, '|');
getline(ss, date, '|');

cout << "\n--- FIR Found ---\n";


cout << "FIR Number: " << firNo
<< "\nName: " << name
<< "\nAddress: " << address
<< "\nCrime Type: " << crime
<< "\nDate: " << date << "\n";
found = true;
break;
}
}

if (!found)
cout << "FIR not found!\n";

inFile.close();
}

int main() {
int choice;

do {
cout << "\n====== Police FIR Record Management ======\n";
cout << "1. File New FIR\n";
cout << "2. View All FIRs\n";
cout << "3. Search FIR by Number\n";
cout << "4. Exit\n";
cout << "Enter your choice: ";
cin >> choice;

switch (choice) {
case 1: fileFIR(); break;
case 2: viewAllFIRs(); break;
case 3: searchFIR(); break;
case 4: cout << "Exiting..."; break;
default: cout << "Invalid choice! Try again.\n";
}
} while (choice != 4);

return 0;
}

You might also like