0% found this document useful (0 votes)
34 views1 page

5

The document contains pseudocode for a voting program that loops through each student to collect their vote for one of the candidates by number input. It includes loops to print candidate names and get vote input, validating the input is a valid candidate number before counting the vote.

Uploaded by

shakhawat azim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

5

The document contains pseudocode for a voting program that loops through each student to collect their vote for one of the candidates by number input. It includes loops to print candidate names and get vote input, validating the input is a valid candidate number before counting the vote.

Uploaded by

shakhawat azim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

f/Each student will vote so we need a FOR loop for NumStudents times

'OR Count(- 1 TO NumStudents


PRINT "Here are the names of the running candidates in your class"
FOR Counter F 1 TO NumCandidates
PRINT "Type this number,Counter, "to vote for",NameCandidates(Counted
NEXT Counter
PRINT To abstain from voting press 0"
INPUT Votelnput //Student should type 0 or 1 or 2 or 3 or 4
HILE Votelnput <0 OR Votelnput>NumCandidates DO
PRINT "Error that is an invalid entry. Please vote by choosing a valid number"
INPUT Votelnput
ENDWHILE
SE Votelnput OF:
0: Abstain e Abstain + 1
1: Votes(1) E Votes(11+1
2: V o te sIZJ E V o te s( 2) + 1
3: V o te s( 3) e V o te s( 3) + 1
4: Votes(4] E Votes(4)+1 VEXT Count

You might also like