C++ • DATA STRUCTURES • CLI ARCHITECTURE
Departmental Voting Management System
A console application developed for Wolaita Sodo University's Fundamentals of Programming curriculum, demonstrating structured records, voter identity verification, and tallying logic.
1. The Academic Challenge & Objectives
As part of the Computer Science curriculum at Wolaita Sodo University (Group 7, Fundamentals of Programming II), the task was to architect an automated voting system from scratch in pure C++. The primary objective was to replace paper ballots in departmental student representative elections with a structured, fraud-resistant digital console pipeline.
Key project constraints included:
- Strict Voter Authentication: Only students registered in the authorized voter roll must be permitted to vote.
- One-Vote Integrity: A voter must be prevented from casting multiple ballots under any circumstances.
- Deterministic Tabulation: The system must tabulate results in constant time and accurately determine the winning department or candidate.
- Zero External Dependencies: Rely exclusively on the standard C++ library (
<iostream>and<string>) for clean cross-platform portability.
2. Data Structures & Architectural Design
The system is built upon composite data structures that encapsulate entity states directly in memory:
struct department {
int id;
string dept_name;
int vote_count;
};
struct user {
int id;
string name;
bool is_voted = false;
};
By coupling each voter record with a boolean is_voted flag, state transitions are maintained throughout the execution lifecycle without needing external database overhead.
Modular Function Architecture:
show_depts(): Iterates through the department array to display indexed ballot choices (Information Technology, Information Systems, Computer Science, Mechanical, Electrical).cast_vote(): Prompts for voter ID input, scans the voter roll via linear search, verifies eligibility, captures the chosen department ID with bounds validation, and atomically increments the tally.show_ranking(): Formats and prints real-time vote distribution across all departments.show_winner(): Executes an extremum search algorithm across the department array to announce the leading department.main(): Implements an interactive event loop with robust switchable choices and graceful exit conditions.
3. Fraud Prevention & Input Validation
Voting integrity is enforced through two critical defensive mechanisms implemented directly in the vote casting routine:
A. Voter ID Verification
When an ID is entered, the system performs a bounded linear search over the array of registered students. If the ID does not match an entry in the pre-configured roll, access is immediately denied with an informative error message.
B. Double-Vote Mitigation
Before any ballot options are presented, the student's record is checked for users_list[found_index].is_voted. If already marked true, the transaction is rejected:
Defensive Verification Logic:
if (users_list[found_index].is_voted) { cout << "Sorry " << users_list[found_index].name << ", you have already voted!\n"; return; }
C. Ballot Boundary Protection
User selections outside the allowable index range (choice < 1 || choice > 5) are safely discarded, preventing array out-of-bounds memory access or segmentation faults.
4. Educational Impact & Algorithmic Takeaways
This project served as a foundational milestone in mastering core systems programming concepts in C++: static memory layout, procedural decomposition, pointer/array mechanics, and defensive input processing. The complete source code is publicly accessible on GitHub at tegegndev/cpp-voting-management-system.