- #1
lionely
- 576
- 2
Homework Statement
Develop an algorithm or write pseudocode to determine the winning candidate for a constituency in
the national elections. The algorithm must accept as input the names of the four candidates and the
number of votes each candidate receives. The successful candidate is the one who received the most votes.
Print the name of the winner and the number of votes he/she received.
Well, I'm not too sure about how to solve this problem. So I was wondering if anyone could give any hints ?
Attempt:
START
Declare: winning_cand,cand1,cand2,cand3,cand4 ---> string
vote1,vote2,vote3,vote4,winning_vote----> integer
Print("enter four names")
read cand1,cand2,cand3,cand4
Print("enter number of votes")
read vote1,vote2,vote3,vote4
If vote 1<vote2 then
vote 2 = winning_vote
else
vote2<vote3 then
vote3=winning_vote
else
vote3<vote4 then
vote4=winning_vote
endif
endif
endif
Then after that I'm not too sure.