please help me in making a voting system. dont know how to tally the votes in c++.

Recommended Answers

All 2 Replies

I'm fairly new to c++ myself, but I can help you a bit as I did this as my final year project.

Are you aiming for a secure system? That is, one that involves cryptography? If so, you might want to start reading on encryption and the lot. I'm sure there's a security API for C++. You could try the bouncycastle API for c++ (I think they have one for c++).

Otherwise, if you just want to tally votes, then why not try getting each vote into different arrays and finding the array size? Say if your system was for obama and mccain, all obama votes (in string) would enter an array for obama, and all mccain votes would enter an array for mccain, and at the end of the election, you find out the size of each array to get the tally.

Sorry I can't provide code examples. I don't know how to. But im sure someone can. Just wanted to give you an idea in case you actually know how to write c++ codes ;)

If all you wish to find is the number of votes received for whatever then why not simply create counters?

e.g.

int option1 = 0;
int option2 = 0;

if( /* someone has voted for option1 */ )
    option1++;
else
    option2++;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.