9581
Comments (756)
sorted by:
You're viewing a single comment thread. View all comments, or full comment thread.
5
ColbyP 5 points ago +5 / -0

Yeah, you literally could. The code to actually scan the ballot may be a bit more complex, but the actual counting is just "if(vote == canidate_1) {canidate_1_votes++} else if(vote == canidate_2) {canidate_2_votes++} etc etc all the way down for each canidate. I'm sure it could be done more efficiently, but the point remains you're just taking a couple variables and adding 1 each time they get a vote. It's not rocket science.

1
GreenCumulon 1 point ago +1 / -0

You would use a switch statement. Switch(cantidate){ Case "trump": Trump++; Break; Case "biden" Biden++; Break;}