You are on page 1of 3

{Program statement- This program accepts the names of a number of candidates

contesting the election. It also accept the position they are contesting and
the number of votes that they recieve in each form. The program calculates
total votes and determines the winner of for each position...}
Program DerickTidort;
uses crt;
Var
candidate_name:array[1..19]of string;
position:array[1..19] of char;
form_1:array[1..19] of integer;
form_2:array[1..19] of integer;
form_3:array[1..19] of integer;
form_4:array[1..19] of integer;
form_5:array[1..19] of integer;
total_votes:array[1..19] of integer;
count,num:integer;
S,T,V,P,R:integer;
a,c:integer;
winnerP,winnerV,winnerS,winnerT,winnerR:integer;
begin
clrscr;
gotoxy(10,3);
textcolor(green);
writeln('************************************************************');
gotoxy (28,5);
textcolor(green);
writeln('SGA ELECTION ANALYSIS');
gotoxy(10,7);
textcolor (green);
writeln('************************************************************');
textcolor(green);
for count:= 1 to 6 do
begin
textcolor(yellow);
writeln('Please enter the name of a candidate.');
readln (candidate_name[count]);
textcolor(white);
writeln('Which position did ',candidate_name[count],' win?');
textcolor(white);
writeln('choose');
textcolor(white);
writeln('P for president');
textcolor(white);
writeln('V for Vice President');
textcolor(white);
writeln('S for secretary');
textcolor(white);
writeln('T for Treasurer');
textcolor(white);
writeln('R for Public Relation Officer');
textcolor(white);
readln(position[count]);
writeln('enter votes for form 1');
readln(form_1[count]);
writeln('enter votes for form 2');
readln(form_2[count]);

writeln('enter votes for form 3');


readln(form_3[count]);
writeln('enter votes for form 4');
readln(form_4[count]);
writeln('enter votes for form 5');
readln(form_5[count]);
total_votes[count] := form_1[count] + form_2[count]+ form_3[count]+ form_4[co
unt]+ form_5[count];
clrscr;
end;
for a:=1 to 6 do
begin
if (position[a])=('P') then
begin
if (total_votes[a] > winnerP) then
begin
winnerP := total_votes[a];
P := a;
end;
end;
if (position[a])=('V') then
begin
if (total_votes[a] > winnerV) then
begin
winnerV := total_votes[a];
V := a;
end;
end;
if (position[a])=('S') then
begin
if (total_votes[a] > winnerS) then
begin
winnerS := total_votes[a];
S := a;
end;
end;
if (position[a])=('T') then
begin
if (total_votes[a] > winnerT) then
begin
winnerT := total_votes[a];
T := a;
end;
end;
if (position[a])=('R') then
begin
if (total_votes[a] > winnerR) then
begin
winnerR := total_votes[a];
R := a;
end;
end;
end;
clrscr;
writeln('NAME
POSITION
for c:= 1to 6 do

TOTAL VOTES');

begin
if (position[c]) = ('P') then
writeln(candidate_name[c],'
tes.');
if (position[c]) = ('T') then
writeln(candidate_name[c],'
tess.');

President

',total_votes[c],'vo

Treasurer

',total_votes[c],'vo

if (position[c]) = ('R') then


writeln(candidate_name[c],' Public Relation Officer
tess.');

',total_votes[c],'vo

if (position[c]) = ('S') then


writeln(candidate_name[c],'
tess.');

Secretary

',total_votes[c],'vo

Vice President

',total_votes[c],'vo

if (position[c]) = ('V') then


writeln(candidate_name[c],'
tess.');
end;
textcolor(lightblue);
writeln(candidate_name[S],'
',winnerS,' votes.');
writeln(candidate_name[T],'
',winnerT,' votes.');
writeln(candidate_name[V],'
l of ',winnerV,' votes.');
writeln(candidate_name[P],'
',winnerP,' votes.');
writeln(candidate_name[R],'
th a total of ',winnerR,' votes.');
readln;
end.

won the position Secretary with a total of


won the position Treasurer with a total of
won the position Vice President with a tota
won the position President with a total of
won the position Public relation officer wi

You might also like