Electronic Voting
Electronic Voting
Electronic Voting
ELECTRONIC VOTTING
Submitted By
DHEERAJ DHARMAPALAN
Of
B.C.A (IIIrd Sem)
(Bachelor Of Computer Application)
2011-2014
CERTIFICATE
Place : THRISSUR
Date : 09-02-2013
ACKNOWLEDGEMENT
DHEERAJ DHARMAPALAN
INDEX
CONTENT PAGE NO
1. Introduction 1
2. System Analysis 2
2.1. Existing System 2
2.2. Proposed System 2
2.3. Proposed System Specification 2
2.3.1. Hardware 2
2.3.2. Software 3
3. System Design 5
3.1. File Design 5
3.2. Source Code 6
3.3. Flow Chart 65
4. System Implementation And Testing 68
4.1. System Testing 68
5. Appendix 69
5.1. Input Output Screen Layout 69
6. Conclusion 84
7. Bibliography 85
INTRODUCTION
1
SYSTEM ANALYSIS
1. Existing System
The existing system is not too user friendly .It
cannot be used without a programmer. This program is programmed by
user as well as computer, it doesn’t have computerized security, i.e. to
check if the ID is fake or not, and a voted person can’t vote again.
So this type of system will make a lot of wastage of time for a
person.
2. Proposed System
The proposed system is user friendly, flexible
and more reliable. Our system provide more facilities than the
existing system, i.e. it can check if a person’s ID is fake or not and
it can also check is a person is voted or not. In most of the section we
have included password though which voters can’t interfere. So
from this we can clearly understand that this is reliable and
secured system.
2
Keyboard
Keyboard is an input device. Used toinput
data into the computer. The proposed system support keyboard
based options. The proposed system allow input data only
through keyboard.
Mouse
Mouse is an input device. It is a pointing
device. It have only one use i.e., closing that application when
complete task of college admission system.
Monitor
Monitor is an output device. It is used to
displays the program and output of the program.
Printer
Laser printer is an output device. It is used
to print out the project report.
3.1. Software
There are different types of software that are
included in this system. They are shown as follows:
3
Windows
It is a GUI (Graphic User interface) based
operating system software developed by Microsoft corporation.
Earlier operating system was running as per keyboard inputs.
Users were supposed to know the operating system commands.
Today everything is on mouse click. Moreover ,since everything is
pictorially represented the operating system has become more user
friendly.
C Programming
C programming is a high level programming
language. C is powerful, flexible, portable and elegantly structured
programming language. Since C combines the features of high level
language with the element of the assembler, it is suitable for both
systems and applications programming. It is undoubtedly the most
wildly used general purpose today.
4
SYSTEM DESIGN
1. File Design
PLATFORM WINDOWS 7
LANGUAGE C
COST
…..
5
SOURCE CODE
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
void ev();
void po();
void tv();
void re();
void ca();
void cr();
void de();
void vo();
void ad();
void ed();
void del();
struct cl
{
char can[20];
6
}c[10],x;
struct vd
{
long int vd;
}vd1[10],vd2;
struct vode
{
long int d,j,w,x,t,u,v;
char f[20],g[2],h[20],k[10],l[5];
char m[40],o[10],q[10],r[20];
}a1[10],aa;
void main()
{
char e1,e2,e3,e4;
repeat:
clrscr();
printf("\n $\n");
printf(" $$$ $\n");
printf(" $$$$$ $ $$$ $ $\n");
printf(" $$$ $$ $$$$$ $$$ $$$$$$ $$$$$ $$$ $$$ $$ $$$$
$$$\n");
7
printf(" $$$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$$$ $$ $$ $$
$$\n");
printf(" $$$$$$$ $$ $$$ $$ $$ $$$$$ $$ $$ $$ $$ $$ $$ $$
\n");
printf(" $$$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$$$ $$ $$
$$\n");
printf(" $$$ $$$$$ $$$$$ $$$ $$ $$ $$ $$$ $$ $$$ $$$$
$$$ $\n");
printf(" $$$$$ $ $ $ $$$\n");
printf(" $$$ $ $$$$$\n");
printf(" $ $$ $$ $$$ $$$$$$ $$$$ $$$ $$ $$
$$\n");
printf("\t\t\t\t $$ $$ $$ $$ $$ $$ $$$$ $$ $$ $$$\n");
printf("\t\t\t\t $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ \n");
printf("\t\t\t\t $$$$ $$ $$ $$ $$ $$ $$$$ $$ $$$$$\n");
printf("\t\t\t\t $$ $$$ $$ $$$$ $$ $$$ $$ $$\n");
printf("\t\t\t\t $ $$$$$\n");
printf("\t\t\t\t $$$\n");
printf("\t\t\t\t $\n\n\n");
printf("\t\t\tENTER 4 DIGIT PASSWORD:");
e1=getch();
printf("*");
8
e2=getch();
printf("*");
e3=getch();
printf("*");
e4=getch();
printf("*");
getch();
if((e1=='l'||e1=='L')&&(e2=='o'||e2=='O')&&(e3=='v'||e3=='V')&
&(e4=='e'||e4=='E'))
{
ev();
}
else
{
goto repeat;
}
getch();
}
//********************** MAIN MENU *********************
void ev()
{
9
char b,e1,e2,e3,e4;
clrscr();
printf("\n\n\n\n {$}{$}{$}{$}{$}{$}{$}{$}{$}{$}\n");
printf(" {$}{$}{$}{$}{$}{$}{$} ELECTRONIC VOTING
{$}{$}{$}{$}{$}{$}{$}\n");
printf(" {$} {$}{$}{$}{$}{$}{$}{$}{$}{$}{$} {$}\n");
printf(" {$} {$}\n");
printf(" {$} {$}\n");
printf(" {$} {1} POLLING {2} REGISTRATION
{$}\n");
printf(" {$} {$}\n");
printf(" {$} {$}\n");
printf(" {$} {3} TOTAL VOTE *{4}* EXIT
{$}\n");
printf(" {$} {$}\n");
printf(" {$} {$}\n");
printf("
{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}\n");
printf(" {$}{$}{$}{$}{$}{$}{$}{$}{$}{$}\n");
printf("
{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}{$}\n");
printf(" {$}\n");
10
printf(" {$}{$}{$}{$}}{PRESS SELECTED SERIAL
NUMBER");
b=getch();
switch(b)
{
case '1':
clrscr();
printf("\n\n\n\n\n\n\n\n\t\t
$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$ POLLING $$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$\n");
printf("\t\t $$$}{ENTER 4 DIGIT PASSWORD:");
e1=getch();
printf("*");
e2=getch();
printf("*");
e3=getch();
printf("*");
11
e4=getch();
printf("*");
getch();
if((e1=='l'||e1=='L')&&(e2=='o'||e2=='O')&&(e3=='v'||e3=='V')&
&(e4=='e'||e4=='E'))
{
po();
}
else
{
ev();
}
break;
case '2':
clrscr();
printf("\n\n\n\n\n\n\n\n\t\t
$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$ REGISTRATION $$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
12
printf("\t\t $$\n");
printf("\t\t $$$}{ENTER 4 DIGIT PASSWORD:");
e1=getch();
printf("*");
e2=getch();
printf("*");
e3=getch();
printf("*");
e4=getch();
printf("*");
getch();
if((e1=='l'||e1=='L')&&(e2=='o'||e2=='O')&&(e3=='v'||e3=='V')&
&(e4=='e'||e4=='E'))
{
re();
}
else
{
ev();
}
break;
13
case '3':
clrscr();
printf("\n\n\n\n\n\n\n\n\t\t
$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$ TOTAL VOTE $$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$\n");
printf("\t\t $$$}{ENTER 4 DIGIT PASSWORD:");
e1=getch();
printf("*");
e2=getch();
printf("*");
e3=getch();
printf("*");
e4=getch();
printf("*");
getch();
if((e1=='l'||e1=='L')&&(e2=='o'||e2=='O')&&(e3=='v'||e3=='V')&
&(e4=='e'||e4=='E'))
14
{
tv();
}
else
{
ev();
}
break;
case '4':
exit(0);
break;
default:
ev();
break;
}
getch();
}
//************************ POLLING ***********************
void po()
{
char v;
15
long int
w=1,k=0,b=0,l=0,u=0,z=0,j=0,i=0,q1=0,q2=0,q3=0,q4=0,q5=0,q6=0,
q7=0,q8=0,q9=0;
FILE *pp,*ca,*vv,*cc;
ca=fopen("VD.txt","r");
while(1)
{
fscanf(ca,"%ld %s %s %s %ld %ld %ld %s %s %s %s %s %s %ld %ld
%ld",&aa.d,aa.f,aa.g,aa.h,&aa.j,&aa.w,&aa.x,aa.k,aa.l,aa.m,aa.o,aa.
q,aa.r,&aa.t,&aa.u,&aa.v);
a1[i].d=aa.d;
strcpy(a1[i].f,aa.f);
strcpy(a1[i].g,aa.g);
strcpy(a1[i].h,aa.h);
a1[i].j=aa.j;
a1[i].w=aa.w;
a1[i].x=aa.x;
strcpy(a1[i].k,aa.k);
strcpy(a1[i].l,aa.l);
strcpy(a1[i].m,aa.m);
strcpy(a1[i].o,aa.o);
strcpy(a1[i].q,aa.q);
16
strcpy(a1[i].r,aa.r);
a1[i].t=aa.t;
a1[i].u=aa.u;
a1[i].v=aa.v;
if(aa.d==a1[i-1].d)
{
break;
}
i++;
b++;
}
fclose(ca);
vv=fopen("VV.txt","r");
while(1)
{
fscanf(vv,"%ld",&vd2.vd);
vd1[j].vd=vd2.vd;
if(vd2.vd==vd1[j-1].vd)
{
break;
}
17
j++;
k++;
}
fclose(vv);
cc=fopen("C-L.txt","r");
while(1)
{
fscanf(cc,"%s",x.can);
strcpy(c[l].can,x.can);
if(strcmp(x.can,c[l-1].can)==0)
{
break;
}
l++;
u++;
}
fclose(cc);
pp=fopen("P.txt","r");
fscanf(pp,"%ld %ld %ld %ld %ld %ld %ld %ld
%ld",&q1,&q2,&q3,&q4,&q5,&q6,&q7,&q8,&q9);
fclose(pp);
18
clrscr();
printf("\n\n\n\n\n\n\n\n\t\t
$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$ SECURITY CHECKING $$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$\n");
printf("\t\t $$$}{ENTER ID No.:");
scanf("%ld",&z);
if(z==143)
{
goto r;
}
for(i=0;i<b;i++)
{
if(z==a1[i].d)
{
goto rep;
}
}
19
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t *****INVALID ID
No.*****\n");
getch();
po();
rep:
for(j=0;j<k;j++)
{
if(z==vd1[j].vd)
{
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t *****YOU HAD
VOTTED*****\n");
getch();
po();
}
}
re:
clrscr();
w=1;
fflush(stdin);
20
printf("\n\n\n\t\t $$$$$$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$ CANDIDATES $$$$$$$$$$\n");
printf("\t\t $$ $$$$$$$$$$$$$$$$ $$\n");
for(l=0;l<u;l++)
{
if(strcmp(c[l].can,"$")!=0)
{
printf("\t\t %ld) %s\n",w,c[l].can);
}
w++;
}
printf("\t\t $$ $$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t $$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("\t\t$$\n");
printf("\t\t$$$}{PRESS SELECTED SERIAL NUMBER");
fflush(stdin);
v=getch();
switch(v)
{
21
case '1':
q1++;
break;
case '2':
q2++;
break;
case '3':
q3++;
break;
case '4':
q4++;
break;
case '5':
q5++;
break;
case '6':
q6++;
break;
case '7':
q7++;
break;
22
case '8':
q8++;
break;
case '9':
q9++;
break;
default:
goto re;
}
vd1[j].vd=z;
vv=fopen("VV.txt","a");
fprintf(vv,"%ld\n",vd1[j].vd);
fclose(vv);
pp=fopen("P.txt","w");
fprintf(pp,"%ld %ld %ld %ld %ld %ld %ld %ld
%ld",q1,q2,q3,q4,q5,q6,q7,q8,q9);
fclose(pp);
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t*****VOTED
SUCCESSFULLY*****\n");
getch();
23
po();
r:
ev();
getch();
}
//********************** TOTAL VOTE *********************
void tv()
{
int i;
long int j=0,l=0,u=0,q[9];
FILE *pp,*cc,*vv;
clrscr();
cc=fopen("C-L.txt","r");
while(1)
{
fscanf(cc,"%s",x.can);
strcpy(c[l].can,x.can);
if(strcmp(x.can,c[l-1].can)==0)
{
break;
}
24
l++;
u++;
}
fclose(cc);
pp=fopen("P.txt","r");
fscanf(pp,"%ld %ld %ld %ld %ld %ld %ld %ld
%ld",&q[1],&q[2],&q[3],&q[4],&q[5],&q[6],&q[7],&q[8],&q[9]);
fclose(pp);
printf("\n\t $$$$$$$$$$$$$$$$\n");
printf("\t $$$$$$$$$$$$$$$$$$$$ TOTAL VOTE
$$$$$$$$$$$$$$$$$$$$\n");
printf("\t $$ $$$$$$$$$$$$$$$$ $$\n");
for(i=0;i<u;i++)
{
printf("\n\t %d) %s GOT {%ld}
VOTES\n",(i+1),c[i].can,q[i+1]);
}
printf("\t $$ $$\n");
printf("\t
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
vv=fopen("VV.txt","w");
vd1[j].vd=0;
25
fprintf(vv,"%ld",vd1[j].vd);
fclose(vv);
pp=fopen("P.txt","w");
q[1]=0;q[2]=0;q[3]=0;q[4]=0;q[5]=0;q[6]=0;q[7]=0;q[8]=0;q[9]=0;
fprintf(pp,"%ld %ld %ld %ld %ld %ld %ld %ld
%ld",q[1],q[2],q[3],q[4],q[5],q[6],q[7],q[8],q[9]);
fclose(pp);
getch();
ev();
}
//********************* REGISTRATION ********************
void re()
{
char b;
clrscr();
printf("\n\n\n\n
$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf(" $$$$$$$$$$$$$$$$$$$$$ REGISTRATION
$$$$$$$$$$$$$$$$$$$$$\n");
printf(" $$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$\n");
printf(" $$ $$\n");
26
printf(" $$ $$\n");
printf(" $$ {1} CANDIDATE LIST {2} VOTERS'
DETAILS $$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
printf(" $$ *{3}* BACK $$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$\n");
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$\n");
printf(" $$\n");
printf(" $$$$$$$$$$$$}{PRESS SELECTED SERIAL
NUMBER");
b=getch();
switch(b)
{
case '1':
27
ca();
break;
case '2':
vo();
break;
case '3':
ev();
break;
default:
re();
break;
}
getch();
}
//******************* CANDIDATE LIST *******************
void ca()
{
char b;
clrscr();
printf("\n\n\n\n
$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
28
printf(" $$$$$$$$$$$$$$$$$$$$$ CANDIDATE LIST
$$$$$$$$$$$$$$$$$$$$$\n");
printf(" $$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
printf(" $$ {1} CREATE {2} DELETE
$$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
printf(" $$ *{3}* BACK $$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$\n");
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$\n");
printf(" $$\n");
printf(" $$$$$$$$$$$$}{PRESS SELECTED SERIAL
NUMBER");
29
b=getch();
switch(b)
{
case '1':
cr();
break;
case '2':
de();
break;
case '3':
re();
break;
default:
ca();
break;
}
getch();
}
//*********** CREATION OF CANDIDATE LIST ***********
void cr()
{
30
FILE *cc;
int i,a,w=1;
clrscr();
printf("\n\n\t\t\t*******************************\n");
printf("\t\t\t* ENTER 9 NAMES OF CANDIDATES *\n");
printf("\t\t\t*******************************\n");
printf("\t\t\t (Enter '0000' to Cancel)\n");
printf("\t\t (Enter '$' If you dont want to Name it)\n");
for(i=0;i<9;i++)
{
printf("\n\t\t\t %d)",w);
scanf("%s",c[i].can);
if(strcmp(c[i].can,"0000")==0)
{
re();
}
w++;
}
cc=fopen("C-L.txt","w");
for(i=0;i<9;i++)
{
31
fprintf(cc,"%s \n",c[i].can);
}
fclose(cc);
getch();
re();
}
//********** DELETION OF CANDIDATE NAME **********
void de()
{
int i=0,b=0;
char z[20],d;
FILE *cc;
clrscr();
cc=fopen("C-L.txt","r");
while(1)
{
fscanf(cc,"%s",x.can);
strcpy(c[i].can,x.can);
if(strcmp(x.can,c[i-1].can)==0)
{
break;
32
}
i++;
b++;
}
fclose(cc);
printf("\n\n\t\t\t*******************************\n");
printf("\t\t\t* DELETING SECTION *\n");
printf("\t\t\t*******************************\n");
printf("\t\t\t (Enter '0000' to Cancel)\n");
printf("\n\n\n\n\tEnter Candidate Name to Delete:");
scanf("%s",z);
if(strcmp(z,"0000")==0)
{
ca();
}
for(i=0;i<b;i++)
{
if(strcmp(z,c[i].can)==0)
{
goto rep;
}
33
}
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t****INVALID
CANDIDATE NAME****\n");
getch();
de();
rep:
repeat:
clrscr();
printf("\n\n\n\n\tDO YOU WANT TO DELETE THIS
CANDIDATE (Y/N):");
scanf("%c",&d);
if(d=='Y'||d=='y')
{
cc=fopen("C-L.txt","w");
for(i=0;i<b;i++)
{
if(strcmp(z,c[i].can)!=0)
{
fprintf(cc,"%s\n",c[i].can);
}
34
else
{
clrscr();
strcpy(c[i].can,"$");
fprintf(cc,"%s\n",c[i].can);
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t****CANDIDATE NAME
IS DELETED****");
}
}
fclose(cc);
}
else if(d=='N'||d=='n')
{
ca();
}
else
{
goto repeat;
}
getch();
ca();
35
}
//******************** VOTERS’ DETAILS ******************
void vo()
{
char b;
clrscr();
printf("\n\n\n\n
$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf(" $$$$$$$$$$$$$$$$$$$$$ VOTERS' DETAILS
$$$$$$$$$$$$$$$$$$$$$\n");
printf(" $$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
printf(" $$ {1} Add {2} Edit $$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
printf(" $$ {3} Delete *{4}* BACK $$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
printf(" $$ $$\n");
36
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$\n");
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n");
printf("
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$\n");
printf(" $$\n");
printf(" $$$$$$$$$$$$}{PRESS SELECTED SERIAL
NUMBER");
b=getch();
switch(b)
{
case '1':
ad();
break;
case '2':
ed();
break;
case '3':
del();
break;
37
case '4':
re();
break;
default:
vo();
break;
}
getch();
}
//************ ADDING OF VOTER’S DETAILS ************
void ad()
{
FILE *ca;
long int i=0,b=0,z=0;
ca=fopen("VD.txt","r");
while(1)
{
fscanf(ca,"%ld %s %s %s %ld %ld %ld %s %s %s %s %s %s %ld %ld
%ld",&aa.d,aa.f,aa.g,aa.h,&aa.j,&aa.w,&aa.x,aa.k,aa.l,aa.m,aa.o,aa.
q,aa.r,&aa.t,&aa.u,&aa.v);
a1[i].d=aa.d;
38
strcpy(a1[i].f,aa.f);
strcpy(a1[i].g,aa.g);
strcpy(a1[i].h,aa.h);
a1[i].j=aa.j;
a1[i].w=aa.w;
a1[i].x=aa.x;
strcpy(a1[i].k,aa.k);
strcpy(a1[i].l,aa.l);
strcpy(a1[i].m,aa.m);
strcpy(a1[i].o,aa.o);
strcpy(a1[i].q,aa.q);
strcpy(a1[i].r,aa.r);
a1[i].t=aa.t;
a1[i].u=aa.u;
a1[i].v=aa.v;
if(aa.d==a1[i-1].d)
{
break;
}
i++;
b++;
39
}
fclose(ca);
clrscr();
printf("\n\t\t\t ******************\n");
printf("\t\t\t * ELECTION FORM *\n");
printf("\t\t\t ******************\n");
printf("\t\t\t(Enter '0000' to Cancel)\n\n");
printf("\tIdentity Card No. : ");
scanf("%ld",&z);
if(z==0000)
{
vo();
}
for(i=0;i<b;i++)
{
if(z==a1[i].d)
{
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t*****ALREADY
REGISTERED*****\n");
getch();
40
ad();
}
}
a1[i].d=z;
ca=fopen("VD.txt","a");
printf("\n");
printf("\tElector's Name : ");
scanf("%s",a1[i].f);
if(strcmp(a1[i].f,"0000")==0)
{
vo();
}
printf("\n");
printf("\tGender (M/F) : ");
scanf("%s",a1[i].g);
if(strcmp(a1[i].g,"0000")==0)
{
vo();
}
printf("\n");
printf("\tName of Parent/Guardian : ");
41
scanf("%s",a1[i].h);
if(strcmp(a1[i].h,"0000")==0)
{
vo();
}
printf("\n");
printf("\tDate Of Birth:DAY(DD) : ");
scanf("%ld",&a1[i].j);
if(a1[i].j==0000)
{
vo();
}
printf("\t MONTH(MM) : ");
scanf("%ld",&a1[i].w);
if(a1[i].w==0000)
{
vo();
}
printf("\t YEAR(YYYY): ");
scanf("%ld",&a1[i].x);
if(a1[i].x==0000)
42
{
vo();
}
printf("\n");
printf("\tWard No. : ");
scanf("%s",a1[i].k);
if(strcmp(a1[i].k,"0000")==0)
{
vo();
}
printf("\tHouse No. : ");
scanf("%s",a1[i].l);
if(strcmp(a1[i].l,"0000")==0)
{
vo();
}
printf("\tAddress : ");
scanf("%s",a1[i].m);
if(strcmp(a1[i].m,"0000")==0)
{
vo();
43
}
printf("\t P.O.");
scanf("%s",a1[i].o);
if(strcmp(a1[i].o,"0000")==0)
{
vo();
}
printf("\tPincode : ");
scanf("%s",a1[i].q);
if(strcmp(a1[i].q,"0000")==0)
{
vo();
}
printf("\n");
printf("\tPlace : ");
scanf("%s",a1[i].r);
if(strcmp(a1[i].r,"0000")==0)
{
vo();
}
printf("\n");
44
printf("\tDate : DAY(DD) : ");
scanf("%ld",&a1[i].t);
if(a1[i].t==0000)
{
vo();
}
printf("\t MONTH(MM) : ");
scanf("%ld",&a1[i].u);
if(a1[i].u==0000)
{
vo();
}
printf("\t YEAR(YYYY): ");
scanf("%ld",&a1[i].v);
if(a1[i].v==0000)
{
vo();
}
fprintf(ca,"%ld %s %s %s %ld %ld %ld %s %s %s %s %s %s %ld %ld
%ld\n",a1[i].d,a1[i].f,a1[i].g,a1[i].h,a1[i].j,a1[i].w,a1[i].x,a1[i].k,a1[i].l
,a1[i].m,a1[i].o,a1[i].q,a1[i].r,a1[i].t,a1[i].u,a1[i].v);
45
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t****THIS RECORD IS
ADDED****");
fclose(ca);
getch();
ad();
}
//*********** EDITING OF VOTER’S DETAILS ************
void ed()
{
FILE *ca;
long int z,i=0,b=0;
char ee;
clrscr();
ca=fopen("VD.txt","r");
printf("\n\n\t\t\t*******************************\n");
printf("\t\t\t* EDITING SECTION *\n");
printf("\t\t\t*******************************\n");
printf("\t\t\t (Enter '0000' to Cancel)\n");
printf("\n\n\n\n\tEnter the ID No.:");
scanf("%ld",&z);
46
if(z==0000)
{
vo();
}
while(1)
{
fscanf(ca,"%ld %s %s %s %ld %ld %ld %s %s %s %s %s %s %ld %ld
%ld",&aa.d,aa.f,aa.g,aa.h,&aa.j,&aa.w,&aa.x,aa.k,aa.l,aa.m,aa.o,aa.
q,aa.r,&aa.t,&aa.u,&aa.v);
a1[i].d=aa.d;
strcpy(a1[i].f,aa.f);
strcpy(a1[i].g,aa.g);
strcpy(a1[i].h,aa.h);
a1[i].j=aa.j;
a1[i].w=aa.w;
a1[i].x=aa.x;
strcpy(a1[i].k,aa.k);
strcpy(a1[i].l,aa.l);
strcpy(a1[i].m,aa.m);
strcpy(a1[i].o,aa.o);
strcpy(a1[i].q,aa.q);
47
strcpy(a1[i].r,aa.r);
a1[i].t=aa.t;
a1[i].u=aa.u;
a1[i].v=aa.v;
if(aa.d==a1[i-1].d)
{
break;
}
i++;
b++;
}
fclose(ca);
for(i=0;i<b;i++)
{
if(z==a1[i].d)
{
goto rep;
}
}
clrscr();
48
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t *****INVALID ID
No.*****\n");
getch();
ed();
rep:
for(i=0;i<b;i++)
{
if(z==a1[i].d)
{
re:
clrscr();
printf("\n\n\n\t\t\t ****RECORD****\n");
printf("\t\t\t ********\n");
printf("\t\tID Card No. : %ld\n",a1[i].d);
printf("\t\tName : %s\n",a1[i].f);
printf("\t\tGender : %s\n",a1[i].g);
printf("\t\tGuardian : %s\n",a1[i].h);
printf("\t\tDOB : %ld/%ld/%ld\n",a1[i].j,a1[i].w,a1[i].x);
printf("\t\tWard No. : %s\n",a1[i].k);
printf("\t\tHouse No. : %s\n",a1[i].l);
printf("\t\tAddress : %s\n",a1[i].m);
49
printf("\t\t P.O.%s\n",a1[i].o);
printf("\t\tPincode : %s\n",a1[i].q);
printf("\t\tPlace : %s\n",a1[i].r);
printf("\t\tDate : %ld/%ld/%ld\n",a1[i].t,a1[i].u,a1[i].v);
printf("\n\n\n\n\tDO YOU WANT TO EDIT THIS RECORD
(Y/N):");
scanf("%c",&ee);
if(ee=='Y'||ee=='y')
{
clrscr();
printf("\n\t\t\t ***EDIT RECORD***\n");
printf("\t\t\t *************\n");
printf("\t\t (Enter '0000' to Cancel)\n");
printf("\t(IF YOU DONT WANT TO CHANGE PRESS 'Ctrl+z'
AND ENTER)\n\n");
printf("\tIdentity Card No. : %ld\n",a1[i].d);
printf("\n");
printf("\tElector's Name : ");
scanf("%s",a1[i].f);
if(strcmp(a1[i].f,"0000")==0)
{
50
vo();
}
printf("\n");
printf("\tGender (M/F) : ");
scanf("%s",a1[i].g);
if(strcmp(a1[i].g,"0000")==0)
{
vo();
}
printf("\n");
printf("\tName of Parent/Guardian : ");
scanf("%s",a1[i].h);
if(strcmp(a1[i].h,"0000")==0)
{
vo();
}
printf("\n");
printf("\tDate Of Birth :
%ld/%ld/%ld\n",a1[i].j,a1[i].w,a1[i].x);
printf("\n");
printf("\tWard No. : ");
51
scanf("%s",a1[i].k);
if(strcmp(a1[i].k,"0000")==0)
{
vo();
}
printf("\tHouse No. : ");
scanf("%s",a1[i].l);
if(strcmp(a1[i].l,"0000")==0)
{
vo();
}
printf("\tAddress : ");
scanf("%s",a1[i].m);
if(strcmp(a1[i].m,"0000")==0)
{
vo();
}
printf("\t P.O.");
scanf("%s",a1[i].o);
if(strcmp(a1[i].o,"0000")==0)
{
52
vo();
}
printf("\tPincode : ");
scanf("%s",a1[i].q);
if(strcmp(a1[i].q,"0000")==0)
{
vo();
}
printf("\n");
printf("\tplace : ");
scanf("%s",a1[i].r);
if(strcmp(a1[i].r,"0000")==0)
{
vo();
}
printf("\n");
printf("\tDate : DAY(DD) : ");
scanf("%ld",&a1[i].t);
if(a1[i].t==0000)
{
vo();
53
}
printf("\t MONTH(MM) : ");
scanf("%ld",&a1[i].u);
if(a1[i].u==0000)
{
vo();
}
printf("\t YEAR(YYYY): ");
scanf("%ld",&a1[i].v);
if(a1[i].v==0000)
{
vo();
}
clrscr();
printf("\n\n\n\t\t\t***EDITED RECORD***\n");
printf("\t\t\t ***************\n");
printf("\t\tID Card No. : %ld\n",a1[i].d);
printf("\t\tName : %s\n",a1[i].f);
printf("\t\tGender : %s\n",a1[i].g);
printf("\t\tGuardian : %s\n",a1[i].h);
printf("\t\tDOB : %ld/%ld/%ld\n",a1[i].j,a1[i].w,a1[i].x);
54
printf("\t\tWard No. : %s\n",a1[i].k);
printf("\t\tHouse No. : %s\n",a1[i].l);
printf("\t\tAddress : %s\n",a1[i].m);
printf("\t\t P.O.%s\n",a1[i].o);
printf("\t\tPincode : %s\n",a1[i].q);
printf("\t\tPlace : %s\n",a1[i].r);
printf("\t\tDate : %ld/%ld/%ld\n",a1[i].t,a1[i].u,a1[i].v);
printf("\n\n\t\t\t***THIS RECORD IS EDITED***");
break;
}
else if(ee=='N'||ee=='n')
{
ed();
}
else
{
goto re;
}
}
}
ca=fopen("VD.txt","w");
55
for(i=0;i<b;i++)
{
fprintf(ca,"%ld %s %s %s %ld %ld %ld %s %s %s %s %s %s %ld %ld
%ld\n",a1[i].d,a1[i].f,a1[i].g,a1[i].h,a1[i].j,a1[i].w,a1[i].x,a1[i].k,a1[i].l
,a1[i].m,a1[i].o,a1[i].q,a1[i].r,a1[i].t,a1[i].u,a1[i].v);
}
fclose(ca);
getch();
ed();
}
//********** DELETION OF VOTER’S DETAILS ***********
void del()
{
FILE *ca;
long int b=0,a,i=0;
char dd;
clrscr();
ca=fopen("VD.txt","r");
printf("\n\n\t\t\t*******************************\n");
printf("\t\t\t* DELETING SECTION *\n");
printf("\t\t\t*******************************\n");
56
printf("\t\t\t (Enter '0000' to Cancel)\n");
printf("\n\n\n\n\tEnter the ID No.:");
scanf("%ld",&a);
if(a==0000)
{
vo();
}
while(1)
{
fscanf(ca,"%ld %s %s %s %ld %ld %ld %s %s %s %s %s %s %ld %ld
%ld",&aa.d,aa.f,aa.g,aa.h,&aa.j,&aa.w,&aa.x,aa.k,aa.l,aa.m,aa.o,aa.
q,aa.r,&aa.t,&aa.u,&aa.v);
a1[i].d=aa.d;
strcpy(a1[i].f,aa.f);
strcpy(a1[i].g,aa.g);
strcpy(a1[i].h,aa.h);
a1[i].j=aa.j;
a1[i].w=aa.w;
a1[i].x=aa.x;
strcpy(a1[i].k,aa.k);
strcpy(a1[i].l,aa.l);
57
strcpy(a1[i].m,aa.m);
strcpy(a1[i].o,aa.o);
strcpy(a1[i].q,aa.q);
strcpy(a1[i].r,aa.r);
a1[i].t=aa.t;
a1[i].u=aa.u;
a1[i].v=aa.v;
if(aa.d==a1[i-1].d)
{
break;
}
i++;
b++;
}
fclose(ca);
for(i=0;i<b;i++)
{
if(a==a1[i].d)
{
goto rep;
}
58
}
clrscr();
printf("\n\n\n\n\n\n\n\n\n\n\t\t\t *****INVALID ID
No.*****\n");
getch();
del();
rep:
for(i=0;i<b;i++)
{
if(a==a1[i].d)
{
re:
clrscr();
printf("\n\n\n\t\t\t ****RECORD****\n");
printf("\t\t\t ********\n");
printf("\t\tID Card No. : %ld\n",a1[i].d);
printf("\t\tName : %s\n",a1[i].f);
printf("\t\tGender : %s\n",a1[i].g);
printf("\t\tGuardian : %s\n",a1[i].h);
printf("\t\tDOB : %ld/%ld/%ld\n",a1[i].j,a1[i].w,a1[i].x);
printf("\t\tWard No. : %s\n",a1[i].k);
59
printf("\t\tHouse No. : %s\n",a1[i].l);
printf("\t\tAddress : %s\n",a1[i].m);
printf("\t\t P.O.%s\n",a1[i].o);
printf("\t\tPincode : %s\n",a1[i].q);
printf("\t\tPlace : %s\n",a1[i].r);
printf("\t\tDate : %ld/%ld/%ld\n",a1[i].t,a1[i].u,a1[i].v);
printf("\n\n\n\n\tDO YOU WANT TO DELETE THIS RECORD
(Y/N):");
scanf("%c",&dd);
if(dd=='Y'||dd=='y')
{
clrscr();
printf("\n\n\n\t\t\t***DELETED RECORD***\n");
printf("\t\t\t ****************\n");
printf("\t\tID Card No. : %ld\n",a1[i].d);
printf("\t\tName : %s\n",a1[i].f);
printf("\t\tGender : %s\n",a1[i].g);
printf("\t\tGuardian : %s\n",a1[i].h);
printf("\t\tDOB : %ld/%ld/%ld\n",a1[i].j,a1[i].w,a1[i].x);
printf("\t\tWard No. : %s\n",a1[i].k);
printf("\t\tHouse No. : %s\n",a1[i].l);
60
printf("\t\tAddress : %s\n",a1[i].m);
printf("\t\t P.O.%s\n",a1[i].o);
printf("\t\tPincode : %s\n",a1[i].q);
printf("\t\tPlace : %s\n",a1[i].r);
printf("\t\tDate : %ld/%ld/%ld\n",a1[i].t,a1[i].u,a1[i].v);
}
else if(dd=='N'||dd=='n')
{
del();
}
else
{
goto re;
}
}
}
ca=fopen("VD.txt","w");
for(i=0;i<b;i++)
{
if(a!=a1[i].d)
{
61
fprintf(ca,"%ld %s %s %s %ld %ld %ld %s %s %s %s %s %s %ld %ld
%ld\n",a1[i].d,a1[i].f,a1[i].g,a1[i].h,a1[i].j,a1[i].w,a1[i].x,a1[i].k,a1[i].l
,a1[i].m,a1[i].o,a1[i].q,a1[i].r,a1[i].t,a1[i].u,a1[i].v);
}
else
{
printf("\n\n\t\t\t***THIS RECORD IS DELETED***");
}
}
fclose(ca);
getch();
del();
}
62
FLOW CHART
START
ELECTRONIC VOTTING
It is used to vote a
candidate to whom
we want.
POLLING
REGISTRATION A
TOTAL VOTE
It is used to know
the total vote of
each candidate.
EXIT
It is used to exit
from the process.
END
63
A
CANDIDATE LIST B
VOTERS’ DETAILS C
BACK
It will help
to go back to
main menu.
B
It is used to
create candidate
CREATE list.
It is used to
DELETE delete candidate
list.
BACK A
64
C
It is used to add
voter’s detail.
ADD
It is used to edit
voter’s detail.
EDIT
It is used to
DELETE delete voter’s
detail.
BACK A
65
SYSTEM IMPLEMENTATION AND
TESTING
1. System Testing
Testing is a process of executing a program
with the interest of finding an error. A good test is one that has
a high probability of finding the yet undiscovered error. Testing is
actually of three basic types which are discussed below :
66
APPENDIX
1. Input Output Screen Layout
Front Screen
Main Menu
67
Polling
68
69
Checking Of Voted Person
70
Registration
71
Candidate List
72
Deletion Of Candidate Name
73
Voters’ Details
74
Adding Of Voter’s Details
75
Checking Of Registration
76
Editing Of Voter’s Details
77
78
Deletion Of Voter’s Details
79
Total Vote
80
81
CONCLUSION
82
BIBLIOGRAPHY
http://www.codeblocks.org
http://en.wikipedia.org/wiki/Code::Blocks
http://www.c++programming.com
83