0% found this document useful (0 votes)
54 views

Counting of Votes: A Mini Project

The document describes a mini project on vote counting using C++. It involves creating a Ballot class with data members like candidate names and vote counts. Member functions get input on candidates, record votes, and display results. The sample output shows running the code for an election with 3 candidates and tallying the votes to get the valid votes, invalid votes, and counts for each candidate. Future enhancements discussed include using the program to conduct actual elections by replacing a physical ballot box.

Uploaded by

rapandian
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Counting of Votes: A Mini Project

The document describes a mini project on vote counting using C++. It involves creating a Ballot class with data members like candidate names and vote counts. Member functions get input on candidates, record votes, and display results. The sample output shows running the code for an election with 3 candidates and tallying the votes to get the valid votes, invalid votes, and counts for each candidate. Future enhancements discussed include using the program to conduct actual elections by replacing a physical ballot box.

Uploaded by

rapandian
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

COUNTING OF VOTES

A MINI PROJECT
By,
N.Selvaganesh(Rollno:2950043),
K.Karthikeyan(Rollno:2950038),
B.Muthukumar(Rollno:2105204).

DEPARTMENT OF INFORMATION TECHNOLOGY,


KAMARAJ COLLEGE OF ENGINEERING AND
TECHNOLOGY,
VIRUDHUNAGAR-626001.

Department of Information Technology

Kamaraj college of Engineering and Technology


Bonofied Certificate

certifies that this project report “COUNTING OF VOTES” a


bonofied work of N.Selvaganesh,K.Karthikeyan,B.Muthukumar
who carried out the mini project work under my supervision.
Staff in charge Head of the department,
department of information technology.

TABLE OF CONTENTS

• Abstract
• Project description
• Flow chart
• Source code
• Sample output
• Feature enhancement
• Conclustion
• Reference

ABSTRACT :
This project “COUNTING OF VOTES”explains about the
counting of votes in ballot system using the c++ programming
language.this is performed using the classes and objects.objects
is a runtime entity and it consists of data member function.class
is the plan or blueprint and it is the collection of objects.class is
a user defined datatype.

In the project”COUNTING OF VOTES”the report


about a class ballot used for counting of votes is given.the
necessary data members and member functions are
initialized.member functions used here are get,display,elect are
used.using this functions the no.of contestants,no.of votes to be
polled,no.of valid votes and no.of invalid votes can be
calculated.this program is less in time and space complexity.

PROJECT DESCRIPTION :

The project “COUNTING OF VOTES” contain a class


BALLOT used in the report.the data members are declared to
get the inputs and for the counting of votes the member
functions get,display,elect are used.the data members used are
vote,contestant name,in the member function GET we get the
no.of candidates and the name of the candidate,in the ELECT
member function we enter the the no.of votes to be polled and
we enter the votes,in display function we display the total no.of
contestants,total no.of votes polled and the no.of valid votes
,no.of invalid votes.In the MAIN function we declare the object
BALLOT B.and we get,elect,display the member functions
using this object.
CODING :
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class ballot
{
int vote[100];
int contest[10];
char name[10][20];
int x,y,sp,z;
public:
void get();
void display();
void elect();
};
void ballot::get()
{
int i;
cout<<"\n ENTER THE NO.OF CANDIDATES
CONTESTING :";
cin>>x;
for(i=1;i<=x;i++)
{
cout<<"enter contestant"<<i<<"name : ";
cin>>name[i];
contest[i]=0;
}
}
void ballot::elect()
{
int k,j,total=0;
sp=0;
cout<<"enter the no.of votes polled :" ;
cin>>y;
cout<<"enter the candidate's number : \n";
for(j=1;j<=y;j++)
{
cout<<"enter the vote :";
cin>>vote[j];
z=0;
for(k=1;k<=x;k++)
{
if(vote[j]==k)
z=vote[j];
}
if(z!=0)
contest[z]++;
else
sp++;
}
for(j=1;j<=x;j++)
total=total+contest[j];
z=total;
total=total+sp;
if(total!=y)
cout<<"\n wrong entries";
}
void ballot::display()
{
int k;
cout<<"\n total contestants : "<<x;
cout<<"\n total votes polled :"<<y;
cout<<"\n valid votes :"<<z;
cout<<"\n invalid votes :"<<sp;
for(k=1;k<=x;k++)
cout<<"\n"<<name[k]<<" :"<<contest[k];
}
main()
{
clrscr();
cout<<"\n\t\t MINIPROJECT ON VOTE COUNTING";
cout<<"\n\t\t**************************************";
ballot b;
b.get();
b.elect();
b.display();
getch();
return(0);
}

SAMPLE OUTPUT:

MINI PROJECT ON VOTE COUNTING


****************************************************
ENTER THE NO.OF CANDIDATES CONTESTING : 3
enter contestant1name : SELVA
enter contestant2name : KARTHI
enter contestant3name : MUTHU
enter the no.of votes polled :20
enter the candidate's number :
enter the vote :1
enter the vote :1
enter the vote :1
enter the vote :2
enter the vote :3
enter the vote :4
enter the vote :3
enter the vote :2
enter the vote :3
enter the vote :1
enter the vote :1
enter the vote :2
enter the vote :3
enter the vote :1
enter the vote :2
enter the vote :3
enter the vote :1
enter the vote :1
enter the vote :2
enter the vote :3

Total contestants : 3
Total votes polled :20
Valid votes :19
Invalid votes :1
SELVA :8
KARTHI :5
MUTHU :6

FUTURE ENHANCEMENT :
Using this program we can conduct the elections such as the
electing the chairperson in a college or institution.we can replace
the ballot box with a system with this program in which we can
give the no.of contestants,their names,total no.of votes and we
can get the result of the election within few minutes after the
election.we need not wait for a long time for the result which is
th main advantage of this program.

CONCLUSTION:
Thus we had created a program for the counting of votes in an
election with ballot box system using the concept of classes and
objects ,and also shown the sample output for the program.
REFERENCE :
1. Meyer,B-”object-oriented software construction”,2nd
edition,prenticehall,1997,ISBNO-13-629155-4.
2.ndProgramming with ANSII C++ step by step procedure
2 edition by bhushantrivedi.
3. Projects using c++,2nd edition by pvn.varalakshmi.

Websites:
1. www.sourcecodeonline.com
2. www.scribd.com.

You might also like