#include<iostream>
#include<string>
using namespace std;
int main()
{
char choice,choice2;
int ca=0,cb=0,cc=0,tv=0;
string sa="FPJ",sb="Roco",sc="GMA";
do
{
cout<<"\t PRESIDENTIAL ELECTIONS\n\n";
cout<<"Candidates \n\n";
cout<<"<A>FPJ\t<B>Roco\t<C>GMA \n";
cout<<"-----------------------\n";
cout<<"Enter <v>vote <r> result and <q> quit : ";
cin>>choice2;
if (choice2=='v')
{ cout<<"Enter your vote:";
cin>>choice;
switch(choice)
{
case 'A':
case 'a':
ca++;
break;
case 'B':
case 'b':
cb++;
break;
case 'C':
case 'c':
cc++;
break;
}
}
else if (choice2=='r')
{
cout<<"\t Presidential Elections\n\n";
cout<<"Candidates:"<<"\t results:"<<"\n\n";
cout<<"<A>FPJ : "<<ca<<"\n";
cout<<"<B>Roco : "<<cb<<"\n";
cout<<"<C>GMA : "<<cc<<"\n\n";
tv=ca+cb+cc;
cout<<"Total Votes : "<<tv<<"\n";
//place "and the winner is : <name> here//
}
else if (choice2=='q')
{
cout<<"Thank you for voting";
}
return 0;
}
this is the error
Z:\ITC25 106I\voting Test\vote test.cpp(54) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
You only wrote do { and didn't finish it with } while ( condition );
And in that case i guess you want to loop until choice2 is not equal to 'q' which if converted to code is:
} while ( choice2 != 'q' ); ( put this just before return 0; )