0% found this document useful (0 votes)
10 views21 pages

Pps Project A.Ruthvik 6669

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

Pps Project A.Ruthvik 6669

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

A

Report on
ELECTION VOTING

PROGRAMMING FOR PROBLEM SOLVING PROJECT


Submitted in partial fulfilment of the requirements for
The Award of the degree of

BACHELOR OF TECHNOLOGY
In
DEPARTMENT OF FRESHMEN ENGINEERING
By
ANJUKANDI RUTHVIK
ROLL NO: - 24K81A6669
Under the esteemed guidance of

Mrs. A. Lakshmi Teja


ASSISTANT PROFESSOR
BRANCH & SECTION: CSE(AI&ML)-B

DEPARTMENT OF FRESHMEN ENGINEERING


St. MARTIN’S ENGINEERING COLLEGE
UGC AUTONOMOUS
NBA & NAAC A+ Accredited
Dhulapally, Secunderabad – 500100
St. MARTIN’S ENGINEERING COLLEGE
UGC AUTONOMOUS
NBA & NAAC A+ Accredited
Dhulapally, Secunderabad – 500100

CERTIFICATE
This is to certify that the PROGRAMMING FOR PROBLEM SOLVING PROJECT
entitled “ELECTION VOTING” is a Bonafide record of independent work done by
ANJUKANDI RUTHVIK (24K81A6669) under my supervision and guidance,
submitted to St. MARTIN’S ENGINEERING COLLEGE, Hyderabad, in partial
fulfilment for the award of the Degree of Bachelor of Technology in COMPUTER
SCIENCE ENGINEERING (AI&ML).

Project Internal Guide Head of Department


Mrs. A. Lakshmi Teja Dr.R. Ranadheer Reddy
ABSTRACT
This C programming project focuses on the development of an Election Voting System,
providing a robust and efficient solution for conducting electronic voting processes. The
program encompasses key features such as candidate registration, voter authentication, ballot
casting, and result tabulation. Utilizing fundamental concepts of C programming, the system
employs data structures, file handling, and conditional statements to ensure the integrity and
security of the electoral process. The implementation follows a modular approach, promoting
code reusability and maintainability. This project serves as a practical illustration of how C
programming can be employed to address the complexities of election systems, balancing
simplicity and functionality while adhering to the principles of secure and transparent voting
processes.
CONTENTS

• INTRODUCTION
• LITERATURE SURVEY
• SYSTEM ANALYSIS
o Existing System
o Proposed System
o Hardware Requirements
o Software Requirements
• FLOWCHART AND ALGORITHM
• SYSTEM IMPLEMENTATION
• SYSTEM TESTING
• OUTPUT SCREENS
• CONCLUSION
• FUTURE ENHANCEMENT
• REFERENCES
INTRODUCTION
In C programming, an election voting system can be implemented to facilitate the casting and
counting of votes in a structured manner. This involves creating a program that manages a list
of candidates, allows voters to make selections, and tallies the votes to declare the election
results. The program typically includes functions for displaying the list of candidates, casting
votes, and presenting the final results. While a basic C program can serve as a starting point
for educational purposes, a comprehensive election voting system would necessitate more
advanced features, such as secure user authentication, data storage, and integrity measures to
ensure the reliability and fairness of the electoral process. Developing a robust election
system requires attention to detail, adherence to legal requirements, and consideration of
security aspects to maintain the integrity of the voting process.

CONTROL STEMENTS THAT ARE USED IN THIS PROJECT ARE

Common control statements include "if" statements for conditional branching. "Switch"
statements are also employed to handle multiple possible outcomes efficiently. Loops, such as
"for" and "while" loops, are crucial for iterating through candidate lists or processing votes
until a specified condition is met.

OPEARATORS USE IN THIS PROJECT ARE

Arithmetic operators, such as addition (+), subtraction (-), multiplication (*), and division (/),
are employed for numerical calculations. Relational operators like equality (==) or inequality
(!=) are utilized to compare. Logical operators such as AND (&&) and OR (||) are valuable
for combining multiple conditions. Assignment operators, including (=), are pivotal for
updating variables with new values. Conditional (ternary) operators offer concise ways to
express conditional logic in a single line, streamlining code readability.

ARRAYS, STRINGS, STRUCTRES AND UNIONS THAT ARE USED IN THIS PROJECT

ARRAYS: -

// Example of an array of structures for candidates

typedef struct

char name[50];
int votes;

Candidate;

Candidate candidates[10]; // An array of 10 candidates

SRTINGS:-

// Example of using strings for candidate names

char candidateName[50];

scanf("%s", candidateName);

STRUCTRES:-

// Example of a structure for a candidate

typedef struct

char name[50];

int votes;

Candidate;

UNIONS: - // Example of a union for different vote types

typedef union {

int integerVote;

float floatVote;

char charVote;

Vote;
LITERATURE SURVEY OR BACKGROUND INFORMATION
C is a general-purpose, high-level programming language created by Dennis Ritchie at Bell
Labs in the early 1970s. It evolved from an earlier language called B and played a crucial role
in the development of operating systems, particularly the UNIX operating system. C is
known for its efficiency, portability, and low-level programming capabilities. It provides a
structured programming approach and supports both procedural and modular programming
paradigms. C has influenced many other programming languages, and its simplicity, power,
and versatility have contributed to its enduring popularity. The development of C led to the
creation of C++, an object-oriented extension, and the C language remains an important
foundation for modern programming, serving as the basis for languages like
C#, Java, and more.

TOKENS USED IN THIS PROJECT:-

In C programming, tokens are the smallest units in the source code, representing individual
elements that the compiler recognizes. Tokens are building blocks that make up the syntax of
a C program. The key types of tokens in C include identifiers, keywords, constants, operators,
and special symbols.

Here's a brief explanation of these token types and how they might be used in the context of
an election voting system:

Identifiers: Identifiers are names given to various program elements, such as variables,
functions, or labels. In an election voting system, identifiers could include names like
candidateName or totalVotes.

Keywords: Keywords are reserved words with specific meanings in the C language.
Examples include int, char, if, and for. Keywords play a critical role in defining the structure
and logic of a C program.

Constants: Constants are unchanging values used in a program. Numeric constants (e.g., 1,
2.5), character constants (e.g., 'A'), and string constants (e.g., "Election Day") could be used
in an election voting system to represent candidate votes, election dates, or other fixed values.

Operators: Operators perform operations on variables and values. Arithmetic operators (+, -,
*, /) can be used for calculating vote totals, while relational operators (==, !=, <, >) can be
used to compare vote counts.
Special Symbols: Special symbols include punctuation and other symbols used to structure
the program. Examples include braces {}, parentheses (), and semicolons ;. These symbols
are crucial for defining blocks of code, function parameters, and separating statements.

DATA TYPES USE IN THIS PROJECT:-

int: The int data type is used to represent integer values. In an election voting system, it could
be used to store the number of votes cast for a candidate or the total number of voters.

int totalVotes;

char: The char data type is used for individual characters. It can be utilized to store characters
such as candidate initials or party affiliations.

char partyAffiliation;

float or double: These data types are used to represent floating-point numbers, which can be
useful for storing percentages or other fractional values related to the election.

float votePercentage;

struct: The struct keyword allows the creation of user-defined data types, which can be handy
for organizing related pieces of information. In an election voting system, a structure might
be used to represent a candidate.

struct Candidate {

char name[50];

int votes;

};

enum: The enum keyword allows the creation of enumerations, which provide a way to
define named integer constants. This can be useful for representing various states or choices
in the election system.

enum ElectionState {

NOT_STARTED,

IN_PROGRESS,
COMPLETED

};

APPLICATIONS THAT ARE DEVOLOPED IN C:-

programming language has been used to develop a wide range of applications across various
domains due to its efficiency, portability, and versatility. Here are some common types of
applications that have been developed in C:

Operating Systems: C was initially developed for implementing the UNIX operating system.
Many operating systems, including Windows and Linux, have components written in C for
performance reasons.

Embedded Systems: C is widely used in embedded systems programming, where it plays a


crucial role in developing software for devices like microcontrollers, automotive systems, and
IoT devices due to its low-level capabilities.

Compilers and Interpreters: The development of compilers and interpreters for other
programming languages often involves the use of C. Popular languages like Python, Ruby,
and Perl have components written in C.

Database Systems: Many database management systems, including MySQL and PostgreSQL,
use C for core functionality due to its efficiency in handling low-level operations.

Web Development: While higher-level languages like JavaScript and Python are more
commonly used in web development, C can be involved in the backend of web servers and
infrastructure.

Graphics and Game Development: C is used in graphics programming and game


development, where performance is critical. Libraries like OpenGL and game engines like
Unreal Engine use C extensively.

Network Programming: C is well-suited for developing network applications and protocols.


Networking libraries and tools are often implemented in C for efficiency and speed.

System Utilities: Many system utilities and tools, such as file management programs,
command-line utilities, and system monitoring tools, are written in C.

Security Software: C is commonly used for developing security-related applications,


including antivirus software, intrusion detection systems, and encryption algorithms.
Scientific and Numerical Applications: C is used in scientific computing and numerical
analysis applications where performance is crucial. It is employed in simulations, modeling,
and data analysis.

Real-time Systems: C is favored in real-time systems due to its ability to manage hardware
resources efficiently. Applications include aerospace systems, medical devices, and industrial
control systems.

Educational Software: C is often used in the development of educational software and


programming environments due to its simplicity and widespread use as a teaching language.
SYSTEM ANALYSIS

1.THE EXISITING SYSTEM HAVE THE FOLLOWING PROCESS

• Voter Registration System


• Voting System
• Vote Counting
• Security Measures
• Result Reporting
• User Interface
• Error Handling
• Audit Trail
• Database Management
• Compliance with Electoral Laws

The following system has many problems as it has minimum security and process of
registration is really slow. And this process has many other disadvantages of security.

2.THE PROPOSED SYSTEM HAVE THE FOLLOWING


PROCESS
• Requirements Analysis
• Database Design
• User Authentication
• Voter Registration System
• Ballot Design
• Secure Voting Mechanism
• Access Control
• Audit Trail and Logging
• Real-time Monitoring
• Result Tabulation
• Security Measures
• Usability and Accessibility
• Compliance with Regulations
• Testing
• Deployment
• Continuous Improvement

The following system when compared to the present system has higher security and has high
applications towards the calculations of votes based on the population of state and calculates
the minimum average and gives the result. The following system also has high amount of
speed towards the calculation as it has modern coding installed.

3.SOFTWARE REQUIREMENTS
• Programming Language
• C Programming Language
• Database Management System (DBMS)
• SQLite, MySQL, PostgreSQL
• User Interface
• Curses Library or Simple GUI Libraries
• Security Libraries
• OpenSSL or Libsodium
• Network Communication
• Sockets Programming
• Authentication Mechanisms
• Libraries for Password Hashing
• Logging and Auditing
• Logging Libraries
• Testing Frameworks
• Unit Testing Frameworks (e.g., Unity for C)
• System Monitoring
• Custom or Existing Monitoring Tool
• Cryptography Tools (Optional)
• GPG (GNU Privacy Guard)
• Version Control
• Git
• Build System
• Make or CMake
• Documentation Tools
• Doxygen or similar
• Compliance with Standards
• Coding Standards and Guidelines
• Integrated Development Environment (IDE)
• Cross-Platform Libraries

4.HARDWARE REQUIREMENTS
• Server Infrastructure
• Database Server
• Network Infrastructure
• Client Devices
• Voting terminals or devices
• Touchscreen displays, input devices
• Security Hardware
• Hardware security modules (HSMs)
• Backup and Redundancy
• Monitoring and Logging
• Power Supply
• Scalability
• Compliance Devices
SYSTEM ARCHITECTRE

FLOWCHART FOR ELECTION VOTING PROCESS


SYSTEM IMPLEMENTATION
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Define a structure for a candidate
typedef struct
{
char name[50];
int votes;
}
Candidate;
// Function to display the list of candidates
void displayCandidates(Candidate candidates[], int numCandidates) {
printf("Candidates:\n");
for (int i = 0; i < numCandidates; i++) {
printf("%d. %s\n", i + 1, candidates[i].name);
}
printf("\n");
}
// Function to cast a vote
void vote(Candidate candidates[], int numCandidates) {
int choice;
printf("Enter the number of your chosen candidate: ");
scanf("%d", &choice);
if (choice >= 1 && choice <= numCandidates) {
candidates[choice - 1].votes++;
printf("Vote cast successfully!\n");
} else
{
printf("Invalid choice. Please try again.\n");
}
}
// Function to display the election results
void displayResults(Candidate candidates[], int numCandidates) {
printf("Election Results:\n");
for (int i = 0; i < numCandidates; i++) {
printf("%s: %d votes\n", candidates[i].name, candidates[i].votes);
}
}
int main() {
int numCandidates;
printf("Enter the number of candidates: ");
canf("%d", &numCandidates);
// Allocate memory for the candidates
Candidate *candidates = (Candidate *)malloc(numCandidates * sizeof(Candidate));
// Get the names of the candidates
for (int i = 0; i < numCandidates; i++) {
printf("Enter the name of candidate %d: ", i + 1);
scanf("%s", candidates[i].name);
candidates[i].votes = 0;
}
int choice;
do
{
printf("\nElection Voting System\n");
printf("1. Display Candidates\n");
printf("2. Cast Vote\n");
printf("3. Display Results\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice)
{
case 1:
displayCandidates(candidates, numCandidates);
break;
case 2:
vote(candidates, numCandidates);
break;
case 3:
displayResults(candidates, numCandidates);
break;
case 4:
printf("Exiting the program. Thank you!\n");
break;
default:
printf("Invalid choice. Please try again.\n");
}
}
while (choice != 4);
// Free allocated memory
free(candidates);
return 0;
}

MODULES AND FUNCTIONS USED IN ELECTION VOTING PROCESS


displayMenu()
registerCandidates()
registerVoters()
castVote()
displayResults()
main()
SYSTEM TESTING AND OUTPUTSCREEN
OUTPUT 1:-

The above output was taken from an online compiler from the website
programiz.com
OUTPUT 2:-
In the first output I took the no.of candidates as 5 and listed them as
1.ram
2. mahi
3.varma
4.mani
5.venkat
Then according to the program it asks about the no.of voters
It was listed as 5
Voter1
Number of the candidate you want to vote for:-
3
Vote cast successfully for varma
In this manner I entered the data for 5 voters and got the final output as
1.ram: 2votes
2.mahi: 2votes
3.varma: 0votes
4.mani: 1votes
5.venkat: 0votes

As for the second output the no.of candidates was taken as 3 and the no.of voters as 2.
CONCLUTION

In conclusion, the integration of C programming in election voting systems plays a pivotal


role in fostering a transparent and efficient democratic process. By automating the voting
process, C programming ensures accuracy, minimizes errors, and expedites result tabulation.
The secure and tamper-resistant nature of C-coded election systems enhances the credibility
of electoral outcomes, instilling trust among citizens. Additionally, the accessibility features
embedded in C-programmed interfaces facilitate inclusive participation, catering to diverse
demographics. Overall, the utilization of C programming in election voting significantly
contributes to the democratic ethos by upholding fairness, reliability, and accessibility in the
electoral framework, thereby serving the broader interests of society.
FUTURE ENHANCEMENT

In this project of election voting process when compared to the modern way of coding
included it has high security and greater enhancement of a single person. In this way we can
maintain irregularities and maintain the errors to minimum. In this way in the future this code
will be in greater advantage since this program was developed using todays modern
problems. As for the future enhancement the program allows to change the code accordingly
in case in case of any errors or enhancement in the code.

REFERENCES

• https://www.nationalgeographic.org/topics/resource-library-voting-process/

You might also like