//program to calculate the votes//
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int i,n,count[100],a=0,b=0,c=0,d=0,e=0,spoilt=0;
cout<<"how many voters?";
cin>>n;
if(n<0)
{
cout<<"invalid";
exit(0);
}
cout<<"the following is the list of the candidates\n";
cout<<"1.CONGRESS.\n";
cout<<"2.BJP.\n";
cout<<"3.NCP.\n";
cout<<"4.MGP.\n";
cout<<"5.INDEPENDENT.\n";
for(i=1;i<=n;i++)
{
cout<<"enter your vote, that is the respective no of ur
candidate:";
cin>>count[i];
if (count[i]==1)
a++;
else if(count[i]==2)
b++;
else if(count[i]==3)
c++;
else if(count[i]==4)
d++;
else if(count[i]==5)
e++;
else
spoilt++;
cout<<"\n";
}
cout<<"the
number of votes are:\n";
cout<<"1.CONGRESS:"<<a<<"\n";
cout<<"2.BJP:"<<b<<"\n";
cout<<"3.NCP:"<<c<<"\n";
cout<<"4.MGP:"<<d<<"\n";
cout<<"5.INDEPENDENT:"<<e<<"\n";
cout<<"spoilt ballot:"<<spoilt<<"\n";
if(a>b && a>c && a>d
&& a>e)
cout<<"the winner is: CONGERSS!!";
else if(b>a
&& b>c && b>d && b>e)
cout<<"the winner is:BJP!!";
else if(c>a
&& c>b && c>d && c>e)
cout<<"the winner is:NCP!!";
else if(d>a
&& d>c && d>b && d>e)
cout<<"the winner is:MGP!!";
else if(e>a
&& e>c && e>d && e>b)
cout<<"the winner is:INDEPENDENT!!";
else
cout<<"there
is a tie";
getch();
}
areee kya bath bhai
ReplyDeletenae ke aya he kya beta bsdk
Delete