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

15 Marker Clubs and Statistics

The document outlines a program for inputting and validating cricket club match statistics, including the number of matches played, wins, draws, and losses. It ensures that the total matches equal the specified number and calculates total points based on performance. Finally, it identifies and outputs the club(s) with the highest points.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

15 Marker Clubs and Statistics

The document outlines a program for inputting and validating cricket club match statistics, including the number of matches played, wins, draws, and losses. It ensures that the total matches equal the specified number and calculates total points based on performance. Finally, it identifies and outputs the club(s) with the highest points.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

// Assume the arrays Clubs, Statistics, and Points have been declared with a suitable maximum size

(e.g., 100 clubs)

// Input the number of matches played by each team


OUTPUT "Enter the number of matches played by each team (maximum 22): "
INPUT Matches
WHILE Matches < 0 OR Matches > 22
OUTPUT "Invalid number of matches. Please enter a value between 0 and 22: "
INPUT Matches
ENDWHILE

// Input the number of cricket clubs


OUTPUT "Enter the number of cricket clubs: "
INPUT NumberOfClubs

FOR ClubIndex FROM 0 TO NumberOfClubs - 1


// Input the name of the cricket club
OUTPUT "Enter the name of club " & ClubIndex + 1 & ": "
INPUT Clubs[ClubIndex]

// Input the number of matches won, drawn, and lost


REPEAT
OUTPUT "Enter the number of matches won by " & Clubs[ClubIndex] & ": "
INPUT Wins
OUTPUT "Enter the number of matches drawn by " & Clubs[ClubIndex] & ": "
INPUT Draws
OUTPUT "Enter the number of matches lost by " & Clubs[ClubIndex] & ": "
INPUT Losses

// Validate the total number of matches


IF Wins + Draws + Losses <> Matches THEN
OUTPUT "The total number of matches (wins + draws + losses) must equal " & Matches & ".
Please re-enter."
ENDIF
UNTIL Wins + Draws + Losses = Matches

// Store the statistics


Statistics[ClubIndex][0] = Wins
Statistics[ClubIndex][1] = Draws
Statistics[ClubIndex][2] = Losses

// Calculate and store the total points


Points[ClubIndex] = (Wins * 12) + (Draws * 5) + (Losses * 0)
NEXT ClubIndex

// Find the highest number of points


HighestPoints = -1 // Initialize with a value lower than any possible score
FOR ClubIndex FROM 0 TO NumberOfClubs - 1
IF Points[ClubIndex] > HighestPoints THEN
HighestPoints = Points[ClubIndex]
ENDIF
NEXT ClubIndex

// Output the club(s) with the highest number of points


OUTPUT "Cricket club(s) with the highest number of points:"
FOR ClubIndex FROM 0 TO NumberOfClubs - 1
IF Points[ClubIndex] = HighestPoints THEN
OUTPUT Clubs[ClubIndex] & " - Wins: " & Statistics[ClubIndex][0] & ", Total Points: " &
Points[ClubIndex]
ENDIF

You might also like