Javatpoint Logo
Javatpoint Logo

Cricket Score Sheet in C

The Cricket Score Sheet project is a straightforward C programming application. It uses file management to store data such as runs, wickets, overs and extras among others. The program can display runs, wickets, batsman and bowler names, overs, bonuses, bowlers' economy, batsman's strike rate and other statistics. It also shows the start and end time of the game. The source code is thorough, error-free and easy to understand.

  • The C source code for this project is extremely simple, containing only seven user-supplied functions. They are mentioned here along with the duties they perform.
  • void date() can be used to store the current date or game date.
  • To print the result in the specified format, use the void printt() method.
  • void filewrite() is used to save input data such as runs, wickets, balls and overs to a file on the computer's hard disk.
  • void fileread() is used to read or extract data from files that have been created to store data.
  • Opens the cricket score project file from the computer using the void fileopen(char) function.
  • limitedinput(int) - for entering a small amount of data.
  • Create a new scoresheet in a new file using the void newscoresheet() method.

The following actions are carried out by the cricket score sheet project file when it is run:

The welcome screen appears at the start of the project and fades up to reveal the main menu. On the main menu, there are three options:

  • Make a fresh score sheet.
  • Check out the previous score sheet.
  • Exit

Project Cricket Score Sheet will prompt for the name of the new score if the number '1' is entered. A notification will appear on the screen after the file is created. The user must then complete a scoring sheet which requires the following details:

  • Competition\Venue
  • Between and against the winning Toss team
  • Draw winner chosen
  • Date and shift
  • The name of each batsman and the runs scored by each
  • Each blower listing the pitcher's name and run

The program will ask the user to press "e" to edit the information and "c" to continue after entering these facts. The application will ask for the file name once the user selects "2" from the main menu. If the file is found, it will be displayed. If not, an error message will appear on the screen. The third option in the main menu is Exit. If the number "3" is entered in the main menu, the Cricket Score Sheet project is terminated.

Program Breakdown

Creating a structure for batsman.

Creating a structure for bowler.

In the main function of the program, the user will be asked to enter the choice.

Score details of the batsman will be handle by above code.

Bowler details will be handle by above code.

If the user has chosen the option 1 to add the details of the batsman than above code will come in action.

If the user has selected the option 2 to add the details of the bowler than the above code will come in action.

If the user wants to see the summary of the match and will select the option 3 then the above code will come in action.

The above code will show the highest runs scored by the batsman and maximum fours scored by the batsman, maximum sixes scored by the batsman and the maximum wickets taken by the bowler.

If the user wants to exit from the system then above code will take care of that.

Program for Cricket Score Sheet in C

Output:

Enter the Batsman detail:
Enter the number of batsman:
 4
Enter name of batsman1:
Rohit
Enter the number of ones scored by player1:
 1
Enter the number of twos scored by player1:
 2
Enter the number of threes scored by player1:
 3
Enter the number of fours scored by player1:
 4
Enter the number of sixes scored by player1:
 6
Enter the balls played by the player1:
50
Enter name of batsman2:
Virat
Enter the number of ones scored by player2:
 1
Enter the number of twos scored by player2:
 4
Enter the number of threes scored by player2:
 2
Enter the number of fours scored by player2:
 2
Enter the number of sixes scored by player2:
 1
Enter the balls played by the player2:
33
Enter name of batsman3:
Hardik
Enter the number of ones scored by player3:
 4
Enter the number of twos scored by player3:
 1
Enter the number of threes scored by player3:
 1
Enter the number of fours scored by player3:
 1
Enter the number of sixes scored by player3:
 1
Enter the balls played by the player3:
35
Enter name of batsman4:
Shikhar
Enter the number of ones scored by player4:
 1
Enter the number of twos scored by player4:
 4
Enter the number of threes scored by player4:
 2
Enter the number of fours scored by player4:
 2
Enter the number of sixes scored by player4:
 2
Enter the balls played by the player4:
24

Enter the bowlers details:
Enter the number of bowlers:
2

Enter name of bowler1:Kunal
Enter the runs given by the bowler1:
 23
Enter the overs bowled by the bowler1:
3
Enter the wickets taken by the bowler1
0

Enter name of bowler2:Jadeja
Enter the runs given by the bowler2:
 43
Enter the overs bowled by the bowler2:
20
Enter the wickets taken by the bowler2
0
Thank you all details are recorded
Enter the choice:
 1)Batsman detail:
 2)Bowlers detail:
 3)Match summary:
 4)Record:
 5)Exit
Enter the batsman number to see his details
1
                       

                                                           Player Detail
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 Batsman        runs           balls        fours       sixes         sr
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 Rohit           66             50            4           6           132.00
Enter the choice:
 1)Batsman detail:
 2)Bowlers detail:
 3)Match summary:
 4)Record:
 5)Exit
Enter the batsman number to see his details
2
                       Player Detail
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 Batsman        runs           balls        fours       sixes         sr
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 Virat           29             33            2           1           87.88
Enter the choice:
 1)Batsman detail:
 2)Bowlers detail:
 3)Match summary:
 4)Record:
 5)Exit
                    Match summary
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 Batsman        runs           balls        fours       sixes         sr
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 Rohit           66             50            4           6           132.00

TOTAL RUNS:66
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 Bowler        overs           runs        wicket       economy
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 Kunal           3              23            0           7.00
 Jadeja          20             43            0           2.00
Highest runs scored by the batsman:66
Maximum fours scored by the batsman:4
Maximum sixes scored by the batsman6:
Maximum wickets taken by the bowler:0
Enter the choice:
 1)Batsman detail:
 2)Bowlers detail:
 3)Match summary:
 4)Record:
 5)Exit






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA