PDF Lab Report
PDF Lab Report
SEMESTER: BE-II
SESSION: 2020-2024
Introduction
Purpose of online voting system
Benefits of online voting system
Pseudo code
Algorithm
Solution
Output
Conclusion
References
ABSTRACT
Online Voting System creates and handles details regarding polling and election
which will enable all citizens to cast their vote via a web-based platform. Database
consisting of records and details of the citizens and candidates who are eligible to
vote are maintained by the system.
Introduction to Online Voting System
In online voting system, voting is done online; this process is very easy.Candidates
are first required to fill a form to register themselves, providing various voting-related
details. These entries are then checked by the system database to see if the candidate
fulfills the voting criteria.If the entries are correct and the citizen is eligible to vote, a
user id and password is given to the voter. By using the information provided,
citizens can cast their vote. The vote cast is automatically recorded and checked in
the system database, and can be counted later.
What is the purpose of online voting system?
Online voting tools and online election voting systems help you make important
decisions by gathering the input of your group in a way that’s systematic and
verifiable.
Online voting allows people in today’s mobile and digitally advanced society to
participate in the democratic process over the internet. The online voting system
offers the highest levels of transparency, control, security and efficiency of election
processes.Online votings provide voters with a comfortable and secure voting
experience and allow election organizers to save resources in planning their next
election.
• First of all we declare or assign the constants mean candidates names. After
that we declare vote count for every candidate for vote casting then we print
our constants mean no. Of candidates by name.
• After that we use switch and break command for vote selection.
• Then we print our vote which select by using switch command.
• To get leading candidate in voting we compare every single candidate vote
with all others .
• By using if else statement.
• And then print the leading candidate.
• After that we use do and switch statement to make the options of :
Caste the vote
Find vote counts
Get leading candidate
Exit
After that we print these options
• And at last we use getchar()
• And end our program
ALGORITHM
STEP#1:
Declare or assign the candidates names.
STEP#2:
Declare vote count for every candidate for vote casting then we print
no. Of candidates by name.
STEP#3:
We use switch and break command for vote selection.
STEP#4:
Print our vote which select by using switch command.
STEP#5:
To get leading candidate in voting we compare every single candidate
vote with all others .
STEP#6:
By using if else statement.
STEP#7:
Print the leading candidate.
STEP#8:
Use do and switch statement to make the options of :
STEP#9:
Caste the vote
STEP#10:
Find vote counts
STEP#11:
Get leading candidate
STEP#12:
Exit
STEP#13:
Print these option
STEP#14:
At last we use getchar()
STEP#15:
End
PROGRAM CODE
#include<stdio.h>
#define CANDIDATE_COUNT
switch(choice){
case 1: votesCount1++; break;
case 2: votesCount2++; break;
case 3: votesCount3++; break;
case 4: votesCount4++; break;
case 5: votesCount5++; break;
case 6: votesCount6++; break;
case 7: votesCount7++; break;
case 8: votesCount8++; break;
case 9: votesCount9++; break;
case 10: votesCount10++; break;
case 11: votesCount11++; break;
case 12: votesCount12++; break;
case 13: votesCount13++; break;
case 14: votesCount14++; break;
case 15: votesCount15++; break;
case 16: votesCount16++; break;
case 17: votesCount17++; break;
case 18: votesCount18++; break;
case 19: votesCount19++; break;
case 20: votesCount20++; break;
default: printf("\n Error: Wrong Choice !! Please retry");
//hold the screen
getchar();
}
printf("\n thanks for vote !!");
}
void votesCount(){
printf("\n\n ##### Voting Statics ####");
printf("\n %s - %d ", CANDIDATE1, votesCount1);
printf("\n %s - %d ", CANDIDATE2, votesCount2);
printf("\n %s - %d ", CANDIDATE3, votesCount3);
printf("\n %s - %d ", CANDIDATE4, votesCount4);
printf("\n %s - %d ", CANDIDATE5, votesCount5);
printf("\n %s - %d ", CANDIDATE6, votesCount6);
printf("\n %s - %d ", CANDIDATE7, votesCount7);
printf("\n %s - %d ", CANDIDATE8, votesCount8);
printf("\n %s - %d ", CANDIDATE9, votesCount9);
printf("\n %s - %d ", CANDIDATE10, votesCount10);
printf("\n %s - %d ", CANDIDATE11, votesCount11);
printf("\n %s - %d ", CANDIDATE12, votesCount12);
printf("\n %s - %d ", CANDIDATE13, votesCount13);
printf("\n %s - %d ", CANDIDATE14, votesCount14);
printf("\n %s - %d ", CANDIDATE15, votesCount15);
printf("\n %s - %d ", CANDIDATE16, votesCount16);
printf("\n %s - %d ", CANDIDATE17, votesCount17);
printf("\n %s - %d ", CANDIDATE18, votesCount18);
printf("\n %s - %d ", CANDIDATE19, votesCount19);
printf("\n %s - %d ", CANDIDATE20, votesCount20);
printf("\n %s - %d ", "Spoiled Votes", Spoiledvotes);
}
void getLeadingCandidate(){
printf("\n\n #### Leading Candiate ####\n\n");
if(votesCount1>votesCount2 && votesCount1>votesCount3 && votesCount1
>votesCount4 && votesCount1 >votesCount5 && votesCount1 >votesCount6
&& votesCount1 >votesCount7 && votesCount1 >votesCount8 &&
votesCount1 >votesCount9 && votesCount1 >votesCount10 && votesCount1
>votesCount11
&& votesCount1 >votesCount12 && votesCount1 >votesCount13 &&
votesCount1 >votesCount14 && votesCount1 >votesCount15 && votesCount1
>votesCount16
&& votesCount1 >votesCount17 && votesCount1 >votesCount18 &&
votesCount1 >votesCount19 && votesCount1 >votesCount20)
printf("[%s]",CANDIDATE1);
else if (votesCount2>votesCount3 && votesCount2>votesCount4 &&
votesCount2 >votesCount1 && votesCount2 >votesCount5 && votesCount2
>votesCount6
&& votesCount2 >votesCount7 && votesCount2 >votesCount8 &&
votesCount2 >votesCount9 && votesCount2 >votesCount10 && votesCount2
>votesCount11
&& votesCount2 >votesCount12 && votesCount2 >votesCount13 &&
votesCount2 >votesCount14 && votesCount2 >votesCount15 && votesCount2
>votesCount16
&& votesCount2 >votesCount17 && votesCount2 >votesCount18 &&
votesCount2 >votesCount19 && votesCount2 >votesCount20)
printf("[%s]",CANDIDATE2);
else if(votesCount3>votesCount4 && votesCount3>votesCount2 && votesCount3
>votesCount1 && votesCount3 >votesCount5 && votesCount3 >votesCount6
&& votesCount3 >votesCount7 && votesCount3 >votesCount8 &&
votesCount3 >votesCount9 && votesCount3 >votesCount10 && votesCount3
>votesCount11
&& votesCount3 >votesCount12 && votesCount3 >votesCount13 &&
votesCount3 >votesCount14 && votesCount3 >votesCount15 && votesCount3
>votesCount16
&& votesCount3 >votesCount17 && votesCount3 >votesCount18 &&
votesCount3 >votesCount19 && votesCount3 >votesCount20)
printf("[%s]",CANDIDATE3);
else if(votesCount4>votesCount1 && votesCount4>votesCount2 && votesCount4
>votesCount3 && votesCount4 >votesCount5 && votesCount4 >votesCount6
&& votesCount4 >votesCount7 && votesCount4 >votesCount8 &&
votesCount4 >votesCount9 && votesCount4 >votesCount10 && votesCount4
>votesCount11
&& votesCount4 >votesCount12 && votesCount4 >votesCount13 &&
votesCount4 >votesCount14 && votesCount4 >votesCount15 && votesCount4
>votesCount16
&& votesCount4 >votesCount17 && votesCount4 >votesCount18 &&
votesCount4 >votesCount19 && votesCount4 >votesCount20)
printf("[%s]",CANDIDATE4);
else if(votesCount5>votesCount1 && votesCount5>votesCount2 && votesCount5
>votesCount3 && votesCount5 >votesCount4 && votesCount5 >votesCount6
&& votesCount5 >votesCount7 && votesCount5 >votesCount8 &&
votesCount5 >votesCount9 && votesCount5 >votesCount10 && votesCount5
>votesCount11
&& votesCount5 >votesCount12 && votesCount5 >votesCount13 &&
votesCount5 >votesCount14 && votesCount5 >votesCount15 && votesCount5
>votesCount16
&& votesCount5 >votesCount17 && votesCount5 >votesCount18 &&
votesCount5 >votesCount19 && votesCount5 >votesCount20)
printf("[%s]",CANDIDATE5);
else if(votesCount6>votesCount1 && votesCount6 >votesCount2 &&
votesCount6 >votesCount3 && votesCount6 >votesCount5 && votesCount6
>votesCount4
&& votesCount6 >votesCount7 && votesCount6 >votesCount8 &&
votesCount6 >votesCount9 && votesCount6 >votesCount10 && votesCount6
>votesCount11
&& votesCount6 >votesCount12 && votesCount6 >votesCount13 &&
votesCount6 >votesCount14 && votesCount6 >votesCount15 && votesCount6
>votesCount16
&& votesCount6 >votesCount17 && votesCount6 >votesCount18 &&
votesCount6 >votesCount19 && votesCount6 >votesCount20)
printf("[%s]",CANDIDATE6);
else if(votesCount7>votesCount1 && votesCount7>votesCount2 &&
votesCount7 >votesCount3 && votesCount7 >votesCount5 && votesCount7
>votesCount6
&& votesCount7 >votesCount4 && votesCount7 >votesCount8 &&
votesCount7>votesCount9 && votesCount7 >votesCount10 && votesCount7
>votesCount11
&& votesCount7 >votesCount12 && votesCount7 >votesCount13 &&
votesCount7 >votesCount14 && votesCount7 >votesCount15 && votesCount7
>votesCount16
&& votesCount7 >votesCount17 && votesCount7 >votesCount18 &&
votesCount7>votesCount19 && votesCount7 >votesCount20)
printf("[%s]",CANDIDATE7);
else if(votesCount8 >votesCount1 && votesCount8 >votesCount2 &&
votesCount8 >votesCount3 && votesCount8 >votesCount5 && votesCount8
>votesCount6
&& votesCount8 >votesCount7 && votesCount8 >votesCount4 &&
votesCount8 >votesCount9 && votesCount8 >votesCount10 && votesCount8
>votesCount11
&& votesCount8 >votesCount12 && votesCount8 >votesCount13 &&
votesCount8>votesCount14 && votesCount8 >votesCount15 && votesCount8
>votesCount16
&& votesCount8>votesCount17 && votesCount8 >votesCount18 &&
votesCount8 >votesCount19 && votesCount8 >votesCount20)
printf("[%s]",CANDIDATE8);
else if(votesCount9>votesCount1 && votesCount9>votesCount2 &&
votesCount9 >votesCount3 && votesCount9 >votesCount5 && votesCount9
>votesCount6
&& votesCount9 >votesCount7 && votesCount9 >votesCount8 &&
votesCount9 >votesCount4 && votesCount9 >votesCount10 && votesCount9
>votesCount11
&& votesCount9 >votesCount12 && votesCount9 >votesCount13 &&
votesCount9>votesCount14 && votesCount9>votesCount15 && votesCount9
>votesCount16
&& votesCount9 >votesCount17 && votesCount9>votesCount18 &&
votesCount9 >votesCount19 && votesCount9>votesCount20)
printf("[%s]",CANDIDATE9);
else if(votesCount10 >votesCount1 && votesCount10>votesCount2 &&
votesCount10 >votesCount3 && votesCount10 >votesCount5 && votesCount10
>votesCount6
&& votesCount10 >votesCount7 && votesCount10>votesCount8 &&
votesCount10>votesCount9 && votesCount10 >votesCount4 &&
votesCount10>votesCount11
&& votesCount10>votesCount12 && votesCount10 >votesCount13 &&
votesCount10 >votesCount14 && votesCount10 >votesCount15 && votesCount10
>votesCount16
&& votesCount10>votesCount17 && votesCount10 >votesCount18 &&
votesCount10 >votesCount19 && votesCount10 >votesCount20)
printf("[%s]",CANDIDATE10);
else if(votesCount11>votesCount1 && votesCount11>votesCount2 &&
votesCount11 >votesCount3 && votesCount11 >votesCount5 && votesCount11
>votesCount6
&& votesCount11>votesCount7 && votesCount11 >votesCount8 &&
votesCount11 >votesCount9 && votesCount11 >votesCount10 &&
votesCount11>votesCount4
&& votesCount11 >votesCount12 && votesCount11>votesCount13 &&
votesCount11 >votesCount14 && votesCount11 >votesCount15 && votesCount11
>votesCount16
&& votesCount11 >votesCount17 && votesCount11>votesCount18 &&
votesCount11 >votesCount19 && votesCount11 >votesCount20)
printf("[%s]",CANDIDATE11);
else if(votesCount12>votesCount1 && votesCount12>votesCount2 &&
votesCount12 >votesCount3 && votesCount12 >votesCount5 && votesCount12
>votesCount6
&& votesCount12 >votesCount7 && votesCount12 >votesCount8 &&
votesCount12 >votesCount9 && votesCount12 >votesCount10 &&
votesCount12>votesCount11
&& votesCount12>votesCount4 && votesCount12 >votesCount13 &&
votesCount12 >votesCount14 && votesCount12 >votesCount15 && votesCount12
>votesCount16
&& votesCount12 >votesCount17 && votesCount12 >votesCount18&&
votesCount12 >votesCount19 && votesCount12 >votesCount20)
printf("[%s]",CANDIDATE12);
else if(votesCount13>votesCount1 && votesCount13>votesCount2 &&
votesCount13 >votesCount3 && votesCount13 >votesCount13 && votesCount13
>votesCount6
&& votesCount13 >votesCount7 && votesCount13 >votesCount8 &&
votesCount13 >votesCount9 && votesCount13 >votesCount10 && votesCount13
>votesCount11
&& votesCount13 >votesCount12 && votesCount13 >votesCount4 &&
votesCount13 >votesCount14 && votesCount13 >votesCount15 && votesCount13
>votesCount16
&& votesCount13 >votesCount17 && votesCount13 >votesCount18&&
votesCount13>votesCount19 && votesCount13 >votesCount20)
printf("[%s]",CANDIDATE13);
else if(votesCount14>votesCount1 && votesCount14>votesCount2 &&
votesCount14>votesCount3 && votesCount14 >votesCount5 && votesCount14
>votesCount6
&& votesCount14 >votesCount7 && votesCount5 >votesCount8 &&
votesCount5 >votesCount9 && votesCount14 >votesCount10 && votesCount14
>votesCount11
&& votesCount14 >votesCount12 && votesCount14 >votesCount13 &&
votesCount14 >votesCount4 && votesCount14 >votesCount15 && votesCount14
>votesCount16
&& votesCount14>votesCount17 && votesCount14 >votesCount18 &&
votesCount14 >votesCount19 && votesCount14 >votesCount20)
printf("[%s]",CANDIDATE14);
else if(votesCount15>votesCount1 && votesCount15>votesCount2 &&
votesCount15 >votesCount3 && votesCount15 >votesCount5 && votesCount15
>votesCount6
&& votesCount15 >votesCount7 && votesCount15 >votesCount8 &&
votesCount15 >votesCount9 && votesCount15 >votesCount10 && votesCount15
>votesCount11
&& votesCount15 >votesCount12 && votesCount15 >votesCount13 &&
votesCount15 >votesCount14 && votesCount15 >votesCount4 && votesCount15
>votesCount16
&& votesCount15 >votesCount17 && votesCount15 >votesCount18 &&
votesCount15 >votesCount19 && votesCount15 >votesCount20)
printf("[%s]",CANDIDATE15);
else if(votesCount16>votesCount1 && votesCount16>votesCount2 &&
votesCount16 >votesCount3 && votesCount16 >votesCount5 && votesCount16
>votesCount6
&& votesCount16 >votesCount7 && votesCount16 >votesCount8 &&
votesCount16 >votesCount9 && votesCount16 >votesCount10 &&
votesCount16>votesCount11
&& votesCount16>votesCount12 && votesCount16 >votesCount13 &&
votesCount16 >votesCount14 && votesCount16 >votesCount15 &&
votesCount16>votesCount4
&& votesCount16>votesCount17 && votesCount16 >votesCount18 &&
votesCount16 >votesCount19 && votesCount16 >votesCount20)
printf("[%s]",CANDIDATE16);
else if(votesCount17>votesCount1 && votesCount17>votesCount2 &&
votesCount17 >votesCount3 && votesCount17 >votesCount5 && votesCount17
>votesCount6
&& votesCount17 >votesCount7 && votesCount17>votesCount8 &&
votesCount17>votesCount9 && votesCount17 >votesCount10 && votesCount17
>votesCount11
&& votesCount17 >votesCount12 && votesCount17 >votesCount13 &&
votesCount17 >votesCount14 && votesCount17>votesCount15 && votesCount17
>votesCount16
&& votesCount17 >votesCount4 && votesCount17 >votesCount18 &&
votesCount17 >votesCount19 && votesCount17 >votesCount20)
printf("[%s]",CANDIDATE17);
else if(votesCount18>votesCount1 && votesCount18>votesCount2 &&
votesCount18 >votesCount3 && votesCount18 >votesCount5 && votesCount18
>votesCount6
&& votesCount18 >votesCount7 && votesCount18>votesCount8 &&
votesCount18 >votesCount9 && votesCount18>votesCount10 &&
votesCount18>votesCount11
&& votesCount18 >votesCount12 && votesCount18>votesCount13 &&
votesCount18 >votesCount14 && votesCount18>votesCount15 &&
votesCount18>votesCount16
&& votesCount18 >votesCount17 && votesCount18 >votesCount4 &&
votesCount18 >votesCount19 && votesCount18>votesCount20)
printf("[%s]",CANDIDATE18);
else if(votesCount19>votesCount1 && votesCount19 >votesCount2 &&
votesCount19 >votesCount3 && votesCount19>votesCount5 && votesCount19
>votesCount6
&& votesCount19 >votesCount7 && votesCount19 >votesCount8 &&
votesCount19 >votesCount9 && votesCount19 >votesCount10 && votesCount19
>votesCount11
&& votesCount19>votesCount12 && votesCount19 >votesCount13 &&
votesCount19 >votesCount14 && votesCount19>votesCount15 && votesCount19
>votesCount16
&& votesCount19 >votesCount17 && votesCount19 >votesCount18 &&
votesCount19 >votesCount4 && votesCount19 >votesCount20)
printf("[%s]",CANDIDATE19);
else if(votesCount20>votesCount1 && votesCount20 >votesCount2 &&
votesCount20 >votesCount3 && votesCount20 >votesCount5 &&
votesCount20>votesCount6
&& votesCount20>votesCount7 && votesCount20 >votesCount8 &&
votesCount20>votesCount9 && votesCount20 >votesCount10 && votesCount20
>votesCount11
&& votesCount20 >votesCount12 && votesCount20 >votesCount13 &&
votesCount20 >votesCount14 && votesCount20>votesCount15 &&
votesCount20>votesCount16
&& votesCount20 >votesCount17 && votesCount20 >votesCount18 &&
votesCount20>votesCount19 && votesCount20 >votesCount4)
printf("[%s]",CANDIDATE20);
printf("----- Warning !!! No-win situation----");
int main()
{
int i;
int choice;
do{
printf("\n\n ==== Welcome to Election/Voting 2021 ====");
printf("\n\n 1. Cast the Vote");
printf("\n 2. Find Vote Count");
printf("\n 3. Find leading Candidate");
printf("\n 0. Exit");
return 0;
}
OUTPUT
CONCLUSION
Online Voting System project aims to increase the voting percentages across the
country; with the proposed system, people outside their hometown can also cast their
vote. It allows groups to securely conduct votes and elections.The online voting
system makes use of computer and internet which makes the overall voting procedure
easy. It saves time and avoids errors such as invalid votes and miscalculation of
votes.Overall, project is very economical and new features can be added as per
user requirements.
REFERENCES
In my report I take help from youtube in making the code. Following are the links of
youtube.
http://youtube.be/F4GWNWzB0Qg
http://youtube.be/WOHhH5BOQfM