jatin thakur project
jatin thakur project
ON
TOPIC
POLICE FIR RECORD MANAGEMENT
FOR THE
SUBJECT
OF
OOP USING C++ (UGCA 1910)
SUBMITTED TO SUBMITTED BY
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
// 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;
inFile.close();
}
void searchFIR() {
ifstream inFile("fir_records.txt");
string line;
int searchNumber;
bool found = false;
if (firNo == searchNumber) {
getline(ss, name, '|');
getline(ss, address, '|');
getline(ss, crime, '|');
getline(ss, date, '|');
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;
}