Dear the gurus;
I am a developing a small program for voting of about 5 candidates. The program should compute and return the candidates and their total tallied votes. If a voter enters a number outside 1-5 it should count it as faulty vote. I have the following program but returns an error. Kindly help
#include<iostream>
#include<conio>
using namespace std;
const int vs=5;
int votesA=0, votesB=0, votesC=0, spoiltvotes=0;//TOTALS ALREADY INITIALISED-GLOBAL
char vote;
void main()
{
// loop over the voting stations
int i;
for (i=1;i<=vs ;i++ )
// loop over voters
cout<<"\n Enter your vote:\t";
cin>>vote;
while( vote<=5)
{
switch(vote)
{
case 1: votesA++;
break;
case 2:votesB++;
break;
case 3:votesC++;
break;
default:spoiltvotes++;
}
cout<<"\n Enter your vote:\t";
cin>>vote;
}
// display the results in a neat presentable format
cout<<"Number of votes for candidate\n\tA:"<<votesA;
cout<<"Number of votes for candidate B:";
cout<<votesB<<"\n\tNumber of votes for candidateC:"<<votesC;
cout<<"\n\nNumber of spoilt votes:\t"<<spoiltvotes;
getch();
return 0;
}