You are on page 1of 5

NAME: ALYAN ASYA HAMED SALIM

CLASS: 3rd SEMESTER DBIT


UNIT: OOP
REG. NO: HDB112-COO5-0499/2015
EMAIL: asyahemed@yahoo.com
CAT TWO
#include <iostream>

using namespace std;

int const size=50;

class ballot

int candidate;

int vote[size];

int choice; //candidate you want to create for voting int vote[size];

int ballot[5];

int spoiltballot;

int i;

public: //spoiltballot public :

void getdisplay(void);

};

void ballot:: getdisplay(void)

cout<<"enter how many candidate you want to make\n";

cin>>candidate;

int a,b,c,d,e;

a=0;

a=b=c=d=e;

cout<<"\nEnter 1-5 Integers\n";


for(int i=0;i< candidate;i++)

cin>>vote[i];

switch(vote[i])

case 1:ballot[a];

a++;

break;

case 2:ballot[b];

b++;

break;

case 3:ballot[c];

c++;

break;

case 4:ballot[d];

d++;

break;

case 5:ballot[e];

e++;

break;

default : ++spoiltballot;

//for displayingint choice;

do
{

cout<<"\n\n\n\nChoices Available\n";

cout<<"\n1) Scored By Ballot A\n";

cout<<"\n2) Scored By Ballot B\n";

cout<<"\n3) Scored By Ballot C\n";

cout<<"\n4) Scored By Ballot D\n";

cout<<"\n5) Scored By Ballot E\n";

cout<<"\n6) Spoilt Ballot\n";

cout<<"\n7) EXIT\n";

cout<<"Enter Your Choice :- ";

cin>>choice;

switch(choice)

case 1: cout<<"Scored By Ballot A is "<<a;

break;

case 2: cout<<"Scored By Ballot B is "<<b;

break;

case 3: cout<<"Scored By Ballot C is "<<c;

break;

case 4: cout<<"Scored By Ballot D is "<<d;

break;

case 5: cout<<"Scored By Ballot E is "<<e;

break;

case 6: cout<<"Spoiltballot were "<<spoiltballot;

break;

}
}

while(1);

int main()

ballot o1;

o1.getdisplay();

You might also like