You are given two parallel array that have already been loaded with data. The pa
ID: 3831324 • Letter: Y
Question
You are given two parallel array that have already been loaded with data. The parallel arrays are: names[] - includes all candidate names votes[] - contains the number of votes that each candidate has received Data in Arrays Write the pseudo code to do the following tasks: Calculate and output to the screen the candidate and the number of votes for the candidate with the highest number of votes. Output to the screen all candidate names and number of votes for all candidates with over 10 votes. this code is written in c++ program it will also like pseudo codeExplanation / Answer
//pseudo code for finding candidate with max votes
//Two parallel arrays
char names[]={'sara jones','sam baker','dona smith','chris','clay','ana'}
int votes[]={10,9,5,20,8,7}
int max=votes[0];
int max_index=0;
for i = 0 to len(votes)
if(votes[i]>max)
max=votes[i]
max_index=i
//After this loop we have candidate with max number of votes
print candidate max no.of votes from votes array and
Candidate name from names[] array
//pseudo code for candidate with votes over 10
for i=0 to length(votes)
if(votes[i]>10)
print votes[i] and names[i]
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.