#include<iostream>
#include<fstream>
#include<string>
using namespace std;
void addBus();
void reserveSeat();
void viewReservations();
void viewBuses();
int main() {
int choice = -1;
while (choice != 99) {
cout << "\n[ 0: Show Menu | 99: Exit ] -> Enter Choice: ";
cin >> choice;
if (choice == 0) {
cout << "\n===== BUS RESERVATION SYSTEM =====";
cout << "\n1. Add Bus Information";
cout << "\n2. Reserve Seat(s)";
cout << "\n3. Show Reservation Report";
cout << "\n4. Show Available Buses";
cout << "\n99. Exit Program";
cout << "\n====================================";
cout << "\nEnter Option: ";
cin >> choice;
}
switch(choice) {
case 1: addBus(); break;
case 2: reserveSeat(); break;
case 3: viewReservations(); break;
case 4: viewBuses(); break;
case 99: cout << "Exiting...\n"; break;
default: if(choice != 0) cout << "Invalid Input!\n";
}
}
return 0;
}
void addBus() {
ofstream busFile("bus_data.txt", ios::app);
string plate, type, chasis;
int seats;
cout << "\n-----ADD BUS-----\n";
cin.ignore();
cout << "Enter Bus Plate Number: ";
getline(cin, plate);
cout << "Enter Bus Chasis Number: ";
getline(cin, chasis);
do {
cout << "Enter Bus Type (mini/big): ";
cin >> type;
} while(type != "mini" && type != "big");
seats = (type == "mini") ? 30 : 50;
// Format: Plate | Chasis | Type | Seats
busFile << plate << "|" << chasis << "|" << type << "|" << seats << endl;
busFile.close();
cout << "Bus added successfully.\n";
}
void reserveSeat() {
viewBuses();
string plate, passenger, bPlate, bChassis, bType, goBack;
int seatNum, requestedSeats, totalSeats = 0, reservedCount = 0;
bool busFound = false;
cout << "\n--- Starting Reservation ---" << endl;
cin.ignore();
cout << "Refer to the list above and enter Bus Plate Number: ";
getline(cin, plate);
ifstream busFile("bus_data.txt");
string line;
while (getline(busFile, bPlate, '|')) {
getline(busFile, bChassis, '|');
getline(busFile, bType, '|');
busFile >> totalSeats;
busFile.ignore();
if (bPlate == plate) {
busFound = true;
break;
}
}
busFile.close();
if (!busFound) {
cout << "Error: Bus not found! Please check the plate number." << endl;
return;
}
ifstream checkSeats("seat.txt");
string sPlate, sName;
int sNum;
while (checkSeats >> sPlate >> sNum) {
getline(checkSeats, sName);
if (sPlate == plate) reservedCount++;
}
checkSeats.close();
int seatsLeft = totalSeats - reservedCount;
cout << "Seats Left in this bus: " << seatsLeft << endl;
cout << "Do you want to see which specific seats are left? (Y/N): ";
char showSeats;
cin >> showSeats;
if (showSeats == 'Y' || showSeats == 'y') {
cout << "Available Seat Numbers: ";
bool first = true;
for (int i = 1; i <= totalSeats; i++) {
bool taken = false;
ifstream verify("seat.txt");
while (verify >> sPlate >> sNum) {
getline(verify, sName);
if (sPlate == plate && sNum == i) {
taken = true;
break;
}
}
verify.close();
if (!taken) {
if (!first) cout << ", ";
cout << i;
first = false;
}
}
cout << endl;
}
cout << "\nHow many seats do you want to reserve? ";
cin >> requestedSeats;
if (requestedSeats > seatsLeft) {
cout << "Error: Only " << seatsLeft << " seats available!" << endl;
return;
}
for (int i = 0; i < requestedSeats; i++) {
retrySeat:
cout << "Enter Seat Number for Passenger " << i + 1 << ": ";
cin >> seatNum;
bool alreadyTaken = false;
ifstream verify("seat.txt");
while (verify >> sPlate >> sNum) {
getline(verify, sName);
if (sPlate == plate && sNum == seatNum) {
alreadyTaken = true;
break;
}
}
verify.close();
if (alreadyTaken || seatNum > totalSeats || seatNum < 1) {
cout << "Invalid or already reserved seat! Enter again." << endl;
goto retrySeat;
}
cout << "Enter Passenger Name: ";
cin.ignore();
getline(cin, passenger);
ofstream seatFile("seat.txt", ios::app);
seatFile << plate << " " << seatNum << " " << passenger << endl;
seatFile.close();
}
cout << "\n------------------------------------" << endl;
cout << "RESERVATION SUCCESSFUL!" << endl;
cout << "Bus Plate: " << plate << " | Chassis: " << bChassis << endl;
cout << "------------------------------------" << endl;
cout << "\nReserve for another bus? (Y/N): ";
cin >> goBack;
if (goBack == "Y" || goBack == "y") reserveSeat();
}
void viewReservations() {
ifstream seatFile("seat.txt");
string plate, passenger, bPlate, bType, bChassis;
int seatNum, totalSeats;
bool empty = true;
cout << "\n--- All Reserved Seats ---" << endl;
while (seatFile >> plate >> seatNum) {
seatFile.ignore();
getline(seatFile, passenger);
string foundChassis = "Unknown";
ifstream busFile("bus_data.txt");
while (getline(busFile, bPlate, '|')) {
getline(busFile, bChassis, '|');
getline(busFile, bType, '|');
busFile >> totalSeats;
busFile.ignore();
if (bPlate == plate) {
foundChassis = bChassis;
break;
}
}
busFile.close();
cout << "Bus: " << plate << " (Chassis: " << foundChassis << ")"
<< " | Seat: " << seatNum << " | Passenger: " << passenger << endl;
empty = false;
}
seatFile.close();
if (empty) cout << "No reservations found." << endl;
}
void viewBuses() {
ifstream busFile("bus_data.txt");
string plate, type, chasis;
int seats;
bool empty = true;
cout << "\n--- Available Buses ---\n";
while (getline(busFile, plate, '|')) {
getline(busFile, chasis, '|');
getline(busFile, type, '|');
busFile >> seats;
busFile.ignore();
cout << "Plate: " << plate << " | Chassis: " << chasis << " | Type: " << type << " | Seats: " << seats << endl;
empty = false;
}
busFile.close();
if (empty) cout << "No buses found.\n";
}
Ch Manan // CYNEX
Computer Science Undergraduate | Cybersecurity | Vibe Coder
Break → Understand → Build → Automate
As a Computer Science undergraduate at UAJK, my passion lies at the intersection of creative coding and cybersecurity. I'm driven by a deep curiosity to understand how systems work, which naturally leads me to explore how they can break.
My approach is rooted in a Linux-first mindset. I believe in the power of the command line and the elegance of automation. This has inspired me to focus on building my own tools, turning complex manual processes into efficient scripts.
I call my style "Vibe Coding" — it's about blending technical logic with creative intuition to build solutions that are not only functional but also feel right. This philosophy guides my journey as I work towards becoming a Cybersecurity Researcher and Automation Tool Developer.
> My Journey
The Spark of Curiosity
My journey began not with formal training, but with a deep-rooted obsession for understanding how systems truly work. It was a path of experimentation, failure, and rebuilding, driven purely by curiosity.
Hands-On Linux Immersion
My early learning phase revolved around Linux. I experimented with Fedora, Kali, and Parrot OS, repeatedly installing, breaking, and optimizing them. This taught me boot processes, shell environments, and kernel interactions from the ground up.
Exploring Design & UI/UX
Parallel to my OS deep-dives, I explored basic web development and UI/UX design. This shaped my sense of visual structure and now influences how I build security tools — with a focus on clarity, minimalism, and usability.
Shift to Cybersecurity Fundamentals
My focus naturally shifted toward cybersecurity. Instead of just learning attacks, I dedicated myself to understanding system vulnerabilities, threat surfaces, and security design principles through labs and deep technical research.
Hybrid Mindset: Engineer, Researcher, Builder
Currently, I operate with a hybrid mindset: Researching threats, Engineering defenses, and Building tools. I prioritize system thinking and logic building over memorization, allowing me to adapt across diverse technologies and attack surfaces.
The Ongoing Mission
This journey is far from over. Every system I explore, every line of code I write, and every lab I attempt adds another layer to my understanding of digital ecosystems and the art of cyber defense.
> Learning Lab
My learning methodology is system-driven, logic-first, and automation-oriented — focused on building deep mental models rather than superficial skill acquisition.
Core Learning Philosophy
Instead of passively consuming tutorials, I:
- Break systems intentionally
- Analyze failure patterns
- Reconstruct logic flows
- Automate repetitive tasks
This approach allows me to internalize system behavior, not just memorize techniques.
Active Learning Domains
Cybersecurity Fundamentals
- Threat modeling
- Attack surfaces
- Security design principles
- Defense mechanisms
Linux Mastery
- Kernel interaction
- Process handling
- System automation
- Advanced shell scripting
Networking Logic
- Protocol behaviors
- Packet flow
- Routing fundamentals
- System communication models
Programming Logic
- Algorithmic thinking
- Memory models
- Modular design
- Performance awareness
Python Automation
- Security scripts
- Recon tools
- Automation workflows
- Process orchestration tools
Hands-On Practice
- Linux installations & troubleshooting
- OS reinstalls & performance tuning
- Virtual machine labs
- Terminal scripting experiments
- Automation workflows
- Cybersecurity practice labs
- TryHackMe platform challenges
Learning Objective
To become a hybrid security engineer + automation tool builder capable of:
- Understanding systems at low-level depth
- Designing efficient security tooling
- Building automated cyber solutions
- Researching emerging attack techniques
- Engineering modern defensive architectures
> C++ Project Showcase
C++ Bus Reservation System
A command-line based application written in C++ for managing bus routes and passenger reservations. This project demonstrates procedural programming, file I/O for data persistence, and structured application design in a console environment.
The complete source code is available on GitHub. You can view it online or clone the repository to run it locally.
git clone https://github.com/Abdul-Manan-C/Bus-Reservation-System.git- Procedural Approach: Logic is organized into functions for specific tasks.
- File-based Storage: Uses `bus_data.txt` and `seat.txt` for persistent storage.
- Standard Libraries: Relies on `iostream`, `fstream`, and `string` for core functionality.
- User Interface: A simple `main` loop with a `switch` statement drives the command-line interface.
- Compiler: Ensure you have a C++ compiler like G++ installed.
- Compile File: Run `g++ main.cpp -o reservation_system`.
- Execute: Run the compiled binary with `./reservation_system`.
- Interact: Follow the on-screen menu to manage the system.