A computer is used to count the votes in an election. At the start of the election, the number of candidates standing is entered. Suppose this value is N ‚?? candidates will then be numbered 1 to N. Each elector in turn has ONE chance to choose his candidate from 1 to N. The program then counts this vote in an array. If an elector keys in a number outside the range 1 to N, this vote is counted separately as a SPOILT VOTE. At the end of the day, the person controlling the election keys in a special code (use 1234) to stop further voting.
The program then prints out the results in DESCENDING order of votes counted. The results for an election with just four candidates might be: CANDIDATE NUMBER VOTES 2 423 3 312 4 125 1 14 SPOILT VOTES = 21 Write a program to perform this task. You may assume that there will not be more than 10 candidates. You can ignore the problem of an elector voting twice or keying in the special stop code.