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.
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.
You would use a switch statement. Switch(cantidate){ Case "trump": Trump++; Break; Case "biden" Biden++; Break;}