Sei sulla pagina 1di 5

Pascal Code

Program Winning_Candidate;
{This program will determine the winning candidate for a specific
constituency}
VAR Tot_votes : array [03) of integer;
Cand_names: These are being declared and stored in array [0..3]
of string; memory for later use by the program.
i, Index, TempVotes:
Integer;

BEGIN

{Read candidate details from user}

for This is a loop which enables the program to run 4 times i:=0
to 3 do;
BEGIN

Writeln('Can you please Names from Region enter candidate ',i+1,'


6
name: ');

ReadLn(Cand_names[i]);

Writeln('Can you please enter Total votes for ',Cand_names[i],': ');

ReadLn(Tot_votes[i]);

END {FOR} This ends the for statement.


BEGIN

{Search candidate with highest votes}

Index:=0;

TempVotes:=Tot_votes[Index];

for i:=1 to 3 do

if Tot_votes[i]>TempVotes then

BEGIN
Index:=i;

TempVotes:=Tot_votes[i];

END; {IF} This ends the IF statement

{Output the winning candidate}

WriteLn('The winning candidate for the general elections is


"',Cand_names[Index],'" with ',Tot_votes[Index],' Votes.');
This will terminate the entire program

Pseudocode
PROGRAM WINNING_CANDIDATE_FOR_GECOM
Description:{This program will determine the winning candidate for a specific
constituency}

Cand_name: String;

Tot_votes,initial_votes,v: Integer;

BEGIN

Initial_votes:=0;

FOR v = 1 to 4 DO;

PRINT (Can you please enter the name of the candidate);

READ (Cand_name);
PRINT (Can you please enter the total votes that the candidate received);

READ (Tot_votes);

IF Tot_votes > Initial_votes THEN;

SET Initial_votes Tot_votes

SET Win_cand Cand_name

ENDFOR;

ENDIF;

PRINT (Please print the name of the winning candidate);

Documentation
The above program was written by to assist the
TRINBARGAM Election commission in order to determine a winner, fair fully
for a specific region that is present in Guyana.
SYSTEM REQUIREMENTS FOR THE ABOVE PROGRAM
General requirements includes:
Windows XP, Windows 2000 Professional sp3, Windows Vista, Windows
8.
Minimum of 64MB ram
2MB hard disk space
Screen resolution of 800 x 600 or higher
Pentium 333MHz or higher
PROGRAM INSTALLATION:
Insert CD-ROM in CD drive
Run setup exe from autorun.
NB: This installation could be done over a network as well.
PROGRAM UNINSTALLATION:
Open control panel.
Click on install/uninstall programs.
Then double click on program name.
After the installation progress, open extension from desktop and enter
information required by program (i.e. names of candidate and their total
votes)
During the writing progress of this program, errors couldve been made by
the programmer, end-user can correct these error (if any present) by using
Ezy Pascal and recompiling the program to identify the areas which contains
the error (s) or by correcting it manually, that is the use of trace tables.

Headings to cover in Programming Component

Content Page

Introduction

Acknowledgement

Program Definition

Pseudocode

Algorithm

Print Screen of Program Before running and after

Program Documentation

Conclusion

Potrebbero piacerti anche