You are on page 1of 20

i

ONLINE VOTING SYSTEM

A MINIPROJECT REPORT

Submitted by

KARI VIKASHINI G (2303737720522094)


ARUL MURUGAN K (2303737720521009)

in partial fulfillment of the requirement


for the award of the degree

of

B.TECH
in

INFORMATION TECHNOLOGY

K.S. RANGASAMY COLLEGE OF TECHNOLOGY


(An Autonomous Institution, affiliated to Anna University Chennai and Approved by AICTE, New Delhi)

TIRUCHENGODE – 637 215

FEBRUARY 2024
ii

K.S. RANGASAMY COLLEGE OF TECHNOLOGY


TIRUCHENGODE - 637 215

BONAFIDE CERTIFICATE

Certified that this project report titled “ONLINE VOTING SYSTEM” is the
bonafide work of KARI VIKASHINI G(2303737720522094) and ARUL
MURUGAN K(2303737720521009) who carried out the project under my
supervision. Certified further, that to the best of my knowledge the work reported
herein does not form part of any other project report or dissertation on the basis of
which a degree or award was conferred on an earlier occasion on this or any other
candidate.

SIGNATURE SIGNATURE
Dr.R.POONKUZHALI M.E., Ph.D V.P.DHIVYA B.E., M.E.
HEAD OF THE DEPARTMENT SUBJECT HANDLER
Professor Assistant Professor
Department of Information Technology Department of Information Technology
K.S. Rangasamy College of Technology K.S. Rangasamy College of Technology
Tiruchengode - 637 215 Tiruchengode - 637 215
iii

DECLARATION

We jointly declare that the project report on “ONLINE VOTING


SYSTEM” is the result of original work done by us and best of our knowledge,
similar work has not been submitted to “ANNA UNIVERSITY CHENNAI” for
the requirement of Degree of B.Tech. This project report is submitted on the partial
fulfillment of the requirement of the award of Degree of B.Tech.

Signature

____________________
KARI VIKASHINI G

____________________
ARUL MURUGAN K

Place : Tiruchengode

Date :
iv

LIST OF FIGURES

FIG No. TITLE PAGE NO.

5.1 Online Voting Form 11

5.2 Candidates Form 12

5.3 Voters Form 13


v

ABSTRACT

The Online Voting system is made for the people of the country residing around the
world and wants to vote for their representative. The election can be conducted in
two ways the paper ballot election and the automated ballot elections.The
automated ballot elections are called the electronic voting. The online voting system
is highly developed and the online polling system can be replaced by accurately and
directly voting online and immediate results. The online voting system is done by
the internet so it can be called the Internet Voting.

The online voting system project receives the information of the voters like
voter id, Mobile Number and candidates details.It help voters to cast vote through
online even if they are away from their country.
vi

TABLE OF CONTENTS

CHAPTER TITLE PAGE NO.

LIST OF FIGURES iv

ABSTRACT v

1 INTRODUCTION 1

2 TOOLS USED 2

2.1 C PROGRAMMING 2

3 DESIGN 5

3.1 FLOWCHART 5

3.2 ALGORITHM 6

4 CODING 7

5 SAMPLE INPUT OUTPUT 11

CONCLUSION 14
1

CHAPTER 1

INTRODUCTION

Simple Online Voting System project is written in C language. In this


system people whose age is above 18 years can give his\her vote online
without going to any physical polling station.Taking about the system, it
contains all the basic functions which include entering voters data such as
name,mobile number.In this mini project there is no such login system. This means
he/she can use all those available features easily without any restriction. It is too
easy to use, he/she can cast vote easily with the help of their Voter ID. The existing
system is manual and the paper based voting which is voted on paper and counted
manually. Voter can use his\her voting right online without any difficulty.
2

CHAPTER 2

TOOL USED

2.1 C PROGRAMMING

C programming language created by Dennis Ritchie at the Bell Laboratories


in 1972. It is a very popular language, despite being old. The main reason for its
popularity is because it is a fundamental language in the field of computer science.C
is very fast, compared to other programming languages, like Java and Python. C is
very versatile; it can be used in both applications and technologies.It was created
from ‘ALGOL’, ‘BCPL’ and ‘B’ programming languages. ‘C’ programming
language contains all the features of these languages and many more additional
concepts that make it unique from other languages.Languages such as C++/Java are
developed from ‘C’. These languages are widely used in various technologies. Thus,
‘C’ forms a base for many other languages that are currently in use.

USES OF THE C PROGRAMMING LANGUAGE

 Procedural Language: The execution of the instructions present in a C


program happens step by step.
 Speed: The C language is much faster as compared to a majority of the
programming languages, such as Python, Java, and many more.
 Portable: A C program can be moved from any given platform to another
one, and we can also run it on that platform without any of the charges.
 General Purposes: We can use the C programming language for developing
operating systems, databases, embedded systems, etc.
3

BASIC C COMMANDS

#include This command includes standard input output header


<stdio.h> file(stdio.h) from the C library before compiling a C program

int main() It is the main function from where C program execution begins.

{ Indicates the beginning of the main function.

Whatever written inside this command “/* */” inside a C


/* */ program, it will not be considered for compilation and
execution.

scanf(); This command gets the input from the user.


printf(); This command prints the output on the screen.

getch(); This command is used for any character input from keyboard.

This command is used to terminate a C program (main


return 0;
function) and it returns 0.

} It is used to indicate the end of the main function.


4

APPLICATION OF C PROGRAMMING

1. It is used for developing system applications.


2. It is widely used for developing desktop applications.
3. Most of the applications by Adobe are developed using ‘C’ programming
language.
4. It is used to develop databases. MySQL is the most popular database
software which is built using ‘C’.
5. It is used in developing an operating system. Operating systems such as
Apple’s OS X, Microsoft’s Windows
6. It is widely used in IOT applications.

FEW DISADVANTAGES OF USING C

1. C doesn't extend its support for object-oriented programming (OOP)


features, which enables the creation of subclasses from parent classes.
2. C lacks namespace features, which means the same variable name can't be
reused in one scope. Without namespaces, it's impossible to declare two variables
with the same name.
3. C lacks exception handling, which is the ability to handle exceptions, such
as bugs and anomalies that can happen during source code
5

CHAPTER 3

DESIGN

3.1 FLOWCHART

START

INPUT VOTER ID

IF VOTER ID NO
IS VALID

INVALID VOTER
YES ID

NO
IF AGE>18

INVALID
VOTER YES

CAST THE VOTE

DISPLAY VOTE COUNT

STOP
6

3.2 ALGORITHM

STEP 1: START THE PROGRAM.

STEP 2: DEFINE STRUCTURES .

STEP 3: DECLARE FUNCTIONS TO ADD CANDIDATE,CAST VOTE AND


DISPLAY THE NAMES OF CANDIDATES.

STEP 4: INPUT NAMES OF CANDIDATES.

STEP 5: CHECK IF VOTERS AGE IS ABOVE 18 AND CONTINUE TO VOTE


ELSE DISPLAY INVALID VOTER.

STEP 6: INPUT VOTER ID AND CHECK IF IT IS VALID.

STEP 7: DISPLAY NAMES OF CANDIDATES AND GET THE VOTE.

STEP 8: DISPLAY THE VOTING COUNTS FOR EACH CANDIDATE.

STEP 9: STOP THE PROGRAM.


7

CHAPTER 4

CODING

#include <stdio.h>
#include <string.h>

#define MAX_CANDIDATES 10
#define MAX_VOTERS 100

// Define structures
struct Candidate {
char name[50];
int votes;
};

struct Voter {
char name[50];
int voted;
};

void addCandidate(struct Candidate candidates[], int *numCandidates);


void displayCandidates(struct Candidate candidates[], int numCandidates);
void castVote(struct Voter voters[], int *numVoters, struct Candidate candidates[],
int numCandidates);
int isValidVoter(struct Voter voters[], int numVoters, char name[]);

int main() {
struct Candidate candidates[MAX_CANDIDATES];
int numCandidates = 0;

struct Voter voters[MAX_VOTERS];


int numVoters = 0;

int choice;
8

do {
printf("\n===== Online Voting System Menu =====\n");
printf("1. Add Candidate\n");
printf("2. Display Candidates\n");
printf("3. Cast Vote\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);

switch (choice) {
case 1:
addCandidate(candidates, &numCandidates);
break;
case 2:
displayCandidates(candidates, numCandidates);
break;
case 3:
castVote(voters, &numVoters, candidates, numCandidates);
break;
case 4:
printf("Exiting...\n");
break;
default:
printf("Invalid choice. Please try again.\n");
}
} while (choice != 4);

return 0;
}

void addCandidate(struct Candidate candidates[], int *numCandidates) {


if (*numCandidates < MAX_CANDIDATES) {
printf("Enter candidate name: ");
scanf("%s", candidates[*numCandidates].name);
candidates[*numCandidates].votes = 0;
(*numCandidates)++;
printf("Candidate added successfully!\n");
} else {
printf("Maximum number of candidates reached!\n");
}
}
9

void displayCandidates(struct Candidate candidates[], int numCandidates) {


printf("\n===== Candidates =====\n");
for (int i = 0; i < numCandidates; i++) {
printf("%d. %s\n", i+1, candidates[i].name);
}
}

void castVote(struct Voter voters[], int *numVoters, struct Candidate candidates[],


int numCandidates) {
char name[50];
int age;
printf("Enter your name: ");
scanf("%s", name);
printf(“Enter your age: ”);
scanf(“%d”,&age);

// Check if voter already voted


if (isValidVoter(voters, *numVoters, name)) {
printf("You have already voted.\n");
return;
}

// Display candidates
displayCandidates(candidates, numCandidates);

int choice;
printf("Enter the number of your chosen candidate: ");
scanf("%d", &choice);

// Validate candidate choice


if (choice < 1 || choice > numCandidates) {
printf("Invalid candidate choice.\n");
return;
}

// Record vote
candidates[choice - 1].votes++;

// Record voter
strcpy(voters[*numVoters].name, name);
voters[*numVoters].voted = 1;
(*numVoters)++;

printf("Vote cast successfully!\n");


}
10

int isValidVoter(struct Voter voters[], int numVoters, char name[]) {


for (int i = 0; i < numVoters; i++) {
if (strcmp(voters[i].name, name) == 0) {
return 1;
}
}
return 0;
}
11

CHAPTER 5

SAMPLE INPUT OUPUT

PAGE 1:

Fig 5.1 Online Voting System Home Form


12

PAGE 2:

Fig 5.2 Candidate Form


13

PAGE 3:

Fig 5.3 Voters Form


14

CONCLUSION

The Online Voting system will manage the Voter’s information by which
voter can login and use his voting rights. The system will incorporate all features
of Voting system . Notably, the absence of a login system allows for seamless
access to all available features without constraints, making it a convenient choice
for users. In this user who is above 18 year’s can cast vote to any party only single
time. Voter can use his\her voting right online without any difficulty.It is too easy to
use, he/she can cast vote easily with the help of their Voter ID. Overall, the Simple
Online Voting System in C project provides a valuable resource for individuals
seeking a basic yet functional tool for handling voting system.

You might also like