You are on page 1of 3

/* this is a simple C++ program to show EVM can show correct results in field

test but manipulated results on cointing day and in both cases voter gets
correct Vote printed for his/her satisfaction
This program can run on windows linux or Mac with C++11 compiler

for linux type g++ -std=c++11 filename.cpp


once file com[iles as shows by no error cursor
type ./a.out to run the program on linux machine
*/

copy and paste from next line to end of file and save the file as evm.cpp as
text file. Ask computer programmer for help

#include <iostream>
#include <string>

using namespace std;

enum Parties{PartyA=1,PartyB,PartyC,PartyD,PartyE};
int vote;

unsigned long tempA,tempB,tempC,tempD,tempE;

unsigned long resultA,resultB,resultC,resultD,resultE;

unsigned long totalvotes;

int q =7;
int main() {

bool resultday;
cout<<"this is C++ program written by a novice programmer that shows three
things"<<endl;
cout<<"point 1 EVM using similar but sophisticated software can print correct
vote for voter satisfaction"<<endl;
cout<<"point 2 EVM can produce correct result for field test of EVM
but ...."<<endl;
cout<<"point 3 EVM can produce manipulated result on election counting day
"<<endl;
cout<<"point 4 this program is written at short notice but sophistcated versions
inc linked to file or database and complictaed alogirthms to shift votes between
party or even choosing which party will win can be built in to this
program"<<endl;
cout<<"hacker needs last access to EVM to place similar code This assemblers or
manufacturers can do easily"<<endl;
cout<<'\n'<<endl;
cout<<'\n'<<endl;

cout<<"Election voting demo begins now showing party A wins if programmer


chooses this day as election counting day"<<endl;

cout<<"if election counting day enter 1(manipulated results) if evm testing day
press 0(correct results)"<<endl;
cin>>resultday;
switch(resultday)
{
case 1:
cout<<"you chose demo of vote manipulation on counting day"<<endl;
cout<<"Start Voting now- enter 1 to vote Party A, 2 for Party B, 3 for
party C 4 for party D 5 for party E- press q to stop and get results"<<endl;
break;
case 0:
cout<<"you chose Field test day to show EVM works correctly"<<endl;
cout<<"Start Voting now- enter 1 to vote Party A, 2 for Party B, 3 for
party C 4 for party D 5 for party E- press q to stop and get results"<<endl;
break;
}

while(cin.get()!='q'){
cin>>vote;

switch(vote)
{
case Parties::PartyA:
cout<<"you voted PartyA"<<endl;
++tempA;
++totalvotes;
break;
case Parties::PartyB:
cout<<"you voted PartyB"<<endl;
++tempB;
++totalvotes;
break;
case Parties::PartyC:
cout<<"you voted PartyC"<<endl;
++tempC;
++totalvotes;
break;

case Parties::PartyD:
cout<<"you voted PartyD"<<endl;
++tempD;
++totalvotes;
break;

case Parties::PartyE:
cout<<"you voted PartyE"<<endl;
++totalvotes;
++tempE;
break;
default:
goto resultday;

break;
}
}

resultday:

if(resultday==1){
while(tempA<tempB||tempA<tempC||tempA<tempD||tempA<tempE){
while(tempB>0){
--tempB;
++tempA;}
while(tempC>0){
--tempC;
++tempA;}
while(tempD>0){
--tempD;
++tempA;}
while(tempE>0){
--tempE;
++tempA;}

}//while loop ends


resultA=tempA;
resultB=tempB;
resultC=tempC;
resultD=tempD;
resultE=tempE;

}
else{
resultA=tempA;
resultB=tempB;
resultC=tempC;
resultD=tempD;
resultE=tempE;

totalvotes:
cout<<"resultA"<<resultA<<endl;
cout<<"resultB"<<resultB<<endl;
cout<<"resultC"<<resultC<<endl;

cout<<"resultD"<<resultD<<endl;
cout<<"resultE"<<resultE<<endl;

cout<<"totalvotes cast today "<<totalvotes<<endl;


return 0;

You might also like