0% found this document useful (0 votes)
34 views29 pages

Kailash

Here are the key software requirements for developing a basic cricket scorecard program in C: - A C compiler like GCC or Microsoft Visual Studio to compile the C code - The C standard library for functions like printf, scanf etc. - Data structures like arrays, structures and functions to model cricket elements - Logic to update scores and stats based on scoring events - Display functions to output the scorecard and player stats - Input validation and error handling for any user input - Testing of different match scenarios to ensure correct output The program can be run on any operating system that supports C compilation like Windows, Linux etc. It does not have any other external dependencies. The focus is on implementing the core logic to

Uploaded by

mpraveen22h
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)
34 views29 pages

Kailash

Here are the key software requirements for developing a basic cricket scorecard program in C: - A C compiler like GCC or Microsoft Visual Studio to compile the C code - The C standard library for functions like printf, scanf etc. - Data structures like arrays, structures and functions to model cricket elements - Logic to update scores and stats based on scoring events - Display functions to output the scorecard and player stats - Input validation and error handling for any user input - Testing of different match scenarios to ensure correct output The program can be run on any operating system that supports C compilation like Windows, Linux etc. It does not have any other external dependencies. The focus is on implementing the core logic to

Uploaded by

mpraveen22h
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/ 29

Sri Ramakrishna Institute of Technology

Coimbatore - 641010
March 2023

CRICKET SCORECARD

PROGRAM USING C LANGUAGE

By

NAME: KAILASH BALAN


REGISTE NO:71382304022
First Year B.E (ECE)
i|Page
APPROVAL AND DECLARATION

This project report titled SPACE BATTLE PROGRAM USING C LANGUAGE was

prepared and submitted by KAILASH BALAN (71382304022) and has been found satisfactory in terms of

scope, quality and presentation as partial fulfillment of the requirement for the Bachelor of engineering

(electronics and communication engineering) in Sri Ramakrishna Institute of Technology,

Coimbatore (SRIT).

Checked and Approved by

Ms. A.Jayasmruthi M.E.,

Project Supervisor

Assistant Professor

Department of Computer Science and Engineering

Department of Science and Humanities Sri Ramakrishna Institute of Technology,

Coimbatore-10 March 2023

2|Page
Text of contents Pg.no

APPROVAL AND DECLARATION SHEET 2

TABLE OF CONTENTS 3

ABSTRACT 4

LIST OF FIGURES 5

CHAPTER 1 INTRODUCTION 6

8
CHAPTER 2 METHODOLOGY

2.1 EXISTING TECHNIQUE 10

2.2 SOFTWARE REQUIREMENTS 11

2.3 PROPOSED METHOD 13

24
CHAPTER 3 EXPECTED RESULTS AND OUTPUT
25
CHAPTER 4 CONCLUSION

3|Page
CRICKET SCORE CARD PROGRAM USING C
LANGUAGE

ABSTRACT

The Cricket Score Card System represents an essential component within the realm of cricket,

offering a comprehensive platform to record, display, and analyze the progress and outcomes of

cricket matches. This digital system provides real-time updates and statistical data, enabling

enthusiasts, teams,and stakeholders to track the live progress of matches and assess player

performances.

Developed as a software application or web-based system, the Cricket Score Card System captures

and presents an array of crucial match information. It includes features such as score tracking,

individual player statistics, team totals, ball-by-ball updates, match summaries, and historical data

storage for future reference and analysis.

The system's primary focus lies in its ability to efficiently manage live match data. It displays real-

time scores, overs bowled, wickets taken, runs scored, partnerships, and other critical match

statistics, ensuring accurateand prompt updates for spectators, commentators, and team

management.

In addition to live match updates, the system incorporates player profiles and performance metrics,

showcasing batting averages, bowling figures, strike rates, and other pertinent statistics. These

statistics offer insights into player contributions, form, and trends, aiding in post-match analysis

and strategic decision-making for future matches.

4|Page
List of Figures

Figure No Page no

Figure 1 Flowchart of User Input Handling 7

Figure 2 Algorithm for Arithmetic Operations 17

Figure 3 Modular Structure of the Code 20

Figure 4 Sample Output Display 26

5|Page
CHAPTER -1

INTRODUCTION

The Cricket Score Card System stands as a pivotal element in modern cricket, revolutionizing the way

matches aretracked, analyzed, and experienced. This digital system serves as the backbone for capturing,

displaying, andpreserving comprehensive match data, providing real-time updates and statistical insights that

cater to the needs ofplayers, enthusiasts, commentators, and team management.

In the dynamic world of cricket, where matches unfold with nuances in every delivery, overs bowled, runs

scored, andwickets taken, the Cricket Score Card System emerges as an indispensable tool. Its development as

a software application or web-based platform redefines the way cricket matches are observed and evaluated.

At its core, this system offers an immersive and comprehensive interface that captures the intricate details of

cricketmatches. It includes features such as live score updates, ball-by-ball commentary, detailed player

statistics, team totals, partnerships, run rates, and over-by-over progress, delivering an engaging and

informative experience to cricket enthusiasts.

The system's primary objective lies in its ability to provide real-time updates during live matches. It acts as a

digital scorecard, ensuring accurate and instant dissemination of match information. Fans, spectators, and

cricket enthusiasts can follow the game's progress closely, staying informed about the constantly evolving

match scenarios.

Moreover, beyond the live updates, the Cricket Score Card System functions as a repository of statistical data,

maintaining historical records of matches, player performances, and team statistics. This treasure trove of

information becomes instrumental in post-match analysis, talent scouting, and strategic planning for future

encounters.

6|Page
Flowchart of User Input Handling-

7|Page
CHAPTER – 2

METHODOLOGY

Developing a cricket scoreboard in C language involves several steps that can be broken down into a

methodology. Below is a general outline of how you might approach building a simple cricket

scoreboard:

Understanding Requirements:

Define the scope of the scoreboard (limited overs, test match, T20, etc.).

Identify key features like displaying runs, wickets, overs, batsmen, bowlers, etc.

Designing the Scoreboard:

Determine the data structure required (e.g., arrays, structures) to store information.

Plan the scoreboard layout and how information will be displayed on the screen.

Implementing Data Structures:

Define structures for storing player details, team information, and match data.

Create arrays or linked structures to manage players' scores, overs, wickets, etc.

Developing Functions:

Write functions for updating scores (runs, wickets, overs), adding players, updating player

information, etc.

Implement functions for displaying the scoreboard, player stats, team scores, etc.

User Interface:

Design the user interface for input (if interactive), such as entering scores, updating overs, etc.

Implement user input handling and validation mechanisms.

8|Page
Testing and Debugging:

Test the scoreboard with various scenarios (runs, wickets, overs, different match formats).

Identify and fix any bugs or issues in the code.

Optimization and Refinement:

Optimize code for better performance if needed.

Refactor code for better readability and maintainability.

Documentation:

Create documentation explaining the code structure, functions, input/output format, etc.

Provide usage instructions if necessary.

Finalizing and Deployment:

Finalize the scoreboard application after testing and refinements.

Deploy or share the scoreboard for use, ensuring it meets the defined requirements.

9|Page
2.1 EXISTING TECHNIQUE

Creating a cricket scorecard in C involves utilizing data structures, functions, and an organized

approach to track and display match-related statistics. A typical technique involves structuring the

code with proper data models, functions to update scores, and a clear display mechanism to

showcase the match details.

To begin, a cricket scorecard can be modeled using structures to represent players and teams.

These structures would hold information such as player names, runs scored, balls faced, total runs

for the team, total wickets, overs bowled, and more. Arrays or linked lists can be employed to

manage multiple players and track their statistics throughout the match.

Functions would be written to simulate actions like scoring runs, taking wickets, and updating

match statistics. These functions should handle the complexities of the game, such as calculating

the total runs, wickets, strike rates, and partnerships. Moreover, they should ensure that the data

structures are updated accurately and consistently.

Displaying the scorecard is crucial. Functions can be created to showcase the match summary,

individual player scores, partnerships, and other essential details. This display mechanism should

present the information in a clear and structured format, making it easy for viewers to understand

the match's progression.

Throughout the development process, considerations should be made for error handling, validation

of input data, and an intuitive user interface if interaction is required. This might involve taking

user input for scoring events, updating player details, or inputting match-specific information.

10 | P a g e
.2.1 SOFTWARE REQUIREMENTS

Certainly! Let's delve into the details of the software requirements for developing and running a

Calculator Program using the C language:

C Compiler:

GCC (GNU Compiler Collection): This open-source compiler is widely used for C

programming. It translates your C source code into machine-readable code. On Windows, you

might use MinGW (Minimalist GNU for Windows) to get GCC.

Microsoft Visual C++: This compiler is provided by Microsoft and is often used for Windows

development. It integrates seamlessly with Visual Studio.

Integrated Development Environment (IDE) (Optional):

Code::Blocks: A free and open-source IDE that supports multiple compilers, including GCC.

Dev-C++: A lightweight and user-friendly IDE for C and C++ programming.

Visual Studio Code: While not a traditional IDE, Visual Studio Code is a highly customizable

and lightweight code editor that supports C/C++ development throughextensions.

Text Editor (Optional):

Notepad++: A free and feature-rich text editor that is popular among developers.

Sublime Text: A sophisticated text editor known for its speed and versatility.

Operating System:

C is a cross-platform language, so you can develop and run your calculator program on various

operating systems, including Windows, Linux, and macOS.

11 | P a g e
Terminal/Command Prompt (for Compilation and Execution):

On Windows, you might use the Command Prompt or PowerShell. On Linux, you can use the

terminal.

On macOS, the terminal is available for running commands. Version Control System

(Optional):

Git: A distributed version control system that allows you to track changes in your codebase. It is

beneficial for collaborative development and maintaining a history of your project.

Example Installation Steps (using GCC and Visual Studio Code):

Install GCC:

Windows: Download and install MinGW, and ensure that the GCC compiler is selected during

installation.

Linux: Use your distribution's package manager to install the build-essential package, which

includes GCC.

macOS: Install Xcode Command Line Tools, which includes GCC.

Install Visual Studio Code:

Windows/Linux/macOS: Download Visual Studio Code from the official website and follow

the installation instructions.

Install Extensions: Open Visual Studio Code, go to the Extensions view (Ctrl+Shift+X), and

search for "C/C++." Install the extension provided by Microsoft.

Write and Save Your C Code:

12 | P a g e
Open Visual Studio Code, create a new file, write your C code, and save it with a .c extension

Compile and Run:

Open a terminal within Visual Studio Code or use your system's terminal. Navigate to the

directory containing your C file.

Compile your code using the gcc command Run the executable

By following these steps and meeting the specified software requirements, you can successfully

develop and execute a Calculator Program using the C language. Adjustments may be necessary

based on your specific development environment and preferences.

13 | P a g e
2.3 PROPOSED METHOD

The provided C program is an implementation of a cricket score card that allows users to

perform various arithmetic operations. Let's break down the key components and

functionalities:

Header Files:

The program includes standard C library header files such as <stdio.h>, <conio.h>, <math.h>,

and <stdlib.h>. These headers provide functions for input/output, mathematical operations, and

program control.

Function Declarations:

The program declares several functions at the beginning, each corresponding to a specific

arithmetic operation (addition, subtraction, multiplication, division, square, square

root).Function declarations ensure that the compiler knows about these functions before they

arecalled in the main function.

Main Function:

The main function is the entry point of the program. It uses a do-while loop to repeatedly

display a menu of operations and perform the selected operation until the user chooses to exit

(option 7).

Switch Statement:

The switch statement is used to execute a block of code based on the value of the variable op,

representing the user's choice. Depending on the user's input, it calls the corresponding function

for addition, subtraction, multiplication, division, square, square root, or exits the program.

14 | P a g e
ALGORITHM:

Initialize Structures:

Create structures to represent players and teams.

Include attributes like player names, runs scored, balls faced, wickets taken, total runs for the
team, total

wickets, overs bowled, and other relevant match statistics.

Define Constants:

Set up constants for maximum players in a team, maximum overs in a match, and other relevant

parameters.

Write Functions:

Develop functions to:

Add players to the team with their details.

Simulate actions like scoring runs, taking wickets, and updating match statistics.

Calculate total runs, wickets, strike rates, partnerships, etc.

Display the match summary, individual player scores, partnerships, and other essential match
details.

Initialize Teams and Players:

Create instances of the team structure.

Add players to each team and initialize their attributes.

Simulate Match Actions:

Simulate various match actions using functions.

For example, simulate a player scoring runs or getting out, update the team's total runs, overs
bowled, and

other statistics accordingly.

Display Scorecard:
15 | P a g e
Implement a function to display the match scorecard.

Display the current score, individual player scores, partnerships, overs bowled, wickets fallen,
and any

other relevant details.

Ensure the output is well-formatted and easy to understand.

Implement User Interaction (Optional):

If required, introduce user interactions to:

Input scoring events.

Update player details.

Input match-specific information.

Implement Error Handling:

Incorporate error handling and data validation mechanisms.

Ensure inputs are validated and the system gracefully handles any unexpected scenarios.

Refine and Test:

Review the code for any optimizations, improvements, or enhancements.

Test the scorecard system with various scenarios and edge cases to ensure accurate tracking and
display

of match-related statistics.

Documentation and Deployment:

Document the code, explaining its structure, functions, input/output formats, and usage
instructions.

Deploy or share the cricket scorecard system, ensuring it meets the defined requirements and
functions correctly.

16 | P a g e
EXPLANATION:

A cricket scorecard is a detailed representation of a cricket match's progress, showcasing

key statistics and performances. In the context of development using the C language, a

cricket scorecard system typically involves organizing match-related data using data

structures like arrays and structures. It captures essential details such as player names,

runs scored, wickets taken, overs bowled, and team totals.Through functions and

algorithms, the system simulates match events like scoring runs, taking wickets, and

updating statistics accordingly. The structure of the code often includes defining player

and team structures, initializing match-specific constants, and creating functions to

manipulate anddisplay match data. Functions handle tasks such as calculating totals, strike

rates, and partnerships, providing a comprehensive view of the match's

progress.Furthermore, the system aims to display the scorecard in a structured and

understandable format, presenting a summary of the match's current state, individual

player performances, partnerships, and other significant match details. Depending on the

complexity of the system, user interaction elements might be integrated to allow input of

scoring events or match-specific information.

The development process involves meticulous coding to accurately capture and update

match statistics while ensuring error handling and data validation for robustness. The end

goal is tocreate a functional and user-friendly cricket scorecard system that accurately

represents thematch's unfolding events, suitable for tracking and analyzing cricket

matches of various formats and complexities.

17 | P a g e
PROGRAM-

#include <stdio.h>

#include <stdlib.h>

struct batsman

char name[25];

int runs, score, balls, toruns, tobal, ones, twos, threes, fours, sixes;

int max_six, max_run, max_four;

float str;

} pl1[100], pl3;

struct bowler

char name[25];

int runsgv, wkttkn, overs;

int max_w;

float econ;

} pl2[100], pl4;

int main()

int plno, choice;

int i, n, m;

printf("Enter the Batsman detail:\n");

printf("Enter the number of batsman:\n");

scanf("%d", &m);

for (i = 0; i < m; i++)

printf("Enter name of batsman%d:\n", i + 1);


18 | P a g e
scanf("%s", pl1[i].name);

printf("Enter the number of ones scored by player%d:\n ", i + 1);

scanf("%d", &pl1[i].ones);

printf("Enter the number of twos scored by player%d:\n ", i + 1);

scanf("%d", &pl1[i].twos);

printf("Enter the number of threes scored by player%d:\n ", i + 1);

scanf("%d", &pl1[i].threes);

printf("Enter the number of fours scored by player%d:\n ", i + 1);

scanf("%d", &pl1[i].fours);

printf("Enter the number of sixes scored by player%d:\n ", i + 1);

scanf("%d", &pl1[i].sixes);

printf("Enter the balls played by the player%d:\n", i + 1);

scanf("%d", &pl1[i].balls);

printf("\nEnter the bowlers details:\n");

printf("Enter the number of bowlers:\n");

scanf("%d", &n);

for (i = 0; i < n; i++)

printf("\nEnter name of bowler%d:", i + 1);

scanf("%s", pl2[i].name);

printf("Enter the runs given by the bowler%d:\n ", i + 1);

scanf("%d", &pl2[i].runsgv);
19 | P a g e
printf("Enter the overs bowled by the bowler%d:\n", i + 1);

scanf("%d", &pl2[i].overs);

printf("Enter the wickets taken by the bowler%d\n", i + 1);

scanf("%d", &pl2[i].wkttkn);

printf("Thank you all details are recorded\n");

do

printf("Enter the choice:\n 1)Batsman detail:\n 2)Bowlers detail:\n 3)Match


summary:\n

4)Record:\n 5)Exit\n ");

scanf("%d", &choice);

switch (choice)

case 1:

printf("Enter the batsman number to see his details\n");

scanf("%d", &plno);

plno--;

printf(" Player Detail\n");

printf("= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = =

= = = = = = =\n");

printf("

Batsman runs balls fours sixes sr \n");


20 | P a g e
printf("= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = =
= = = = = = =\n");

pl1[plno].runs = (1 * pl1[plno].ones) + (2 * pl1[plno].twos) + (3 *


pl1[plno].threes)

+ (4 * pl1[plno].fours) + (6 * pl1[plno].sixes);

pl1[plno].str = (pl1[plno].runs * 100.00) / pl1[plno].balls;

printf(" %-15s %-14d %-13d %-11d %-11d %-9.2f\n\n", pl1[plno].name,


pl1[plno].runs,

pl1[plno].balls, pl1[plno].fours, pl1[plno].sixes, pl1[plno].str);

break;

case 2:

printf("Enter the bowlers number to see his details\n");

scanf("%d", &plno);

plno--;

printf(" Player Detail\n ");

printf(" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = =

= = = = = = = = \n");

printf(" Bowler overs runs wicket economy\n");

printf(" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = =

= = = = = = = = = = \n");

for (i = 0; i < n; i++)

pl2[plno].econ = pl2[plno].runsgv / pl2[plno].overs;

printf(" %-15s %-14d %-13d %-11d %-11.2f\n\n", pl2[plno].name,


pl2[plno].overs,

21 | P a g e
pl2[plno].runsgv, pl2[plno].wkttkn, pl2[plno].econ);

break;

case 3:

printf(" Match summary\n");

printf(" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = =

= = = = = = = = = = = = = = = = = = = = = \n");

printf("

Batsman runs balls fours sixes sr \n");

printf(" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = =

= = = = = = = = = = = = = = = = = = = = = \n");

for (i = 0; i < 1; i++)

pl1[i].runs = (1 * pl1[i].ones) + (2 * pl1[i].twos) + (3 * pl1[i].threes) +


(4 *

pl1[i].fours) + (6 * pl1[i].sixes);

pl3.toruns += pl1[i].runs;

pl1[i].str = (pl1[i].runs * 100.00) / pl1[i].balls;

printf(" %-15s %-14d %-13d %-11d %-11d %-9.2f\n\n", pl1[i].name,


pl1[i].runs,

pl1[i].balls, pl1[i].fours, pl1[i].sixes, pl1[i].str);

printf("TOTAL RUNS:%d\n\n", pl3.toruns);

printf("\n\n");

printf("= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= =

22 | P a g e
= = = = = = = = = = = = = = = \n");

printf(" Bowler overs runs wicket economy\n");

printf(" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = = =\n");

for (i = 0; i < n; i++)

pl2[i].econ = pl2[i].runsgv / pl2[i].overs;

printf(" %-15s %-14d %-13d %-11d %-11.2f\n\n\n", pl2[i].name, pl2[i].overs,

pl2[i].runsgv, pl2[i].wkttkn, pl2[i].econ);

break;

case 4:

pl3.max_run = 0, pl4.max_w = 0, pl3.max_four = 0, pl3.max_six = 0;

for (i = 0; i < m; i++)

pl1[i].runs = (1 * pl1[i].ones) + (2 * pl1[i].twos) + (3 * pl1[i].threes) +


(4 *

pl1[i].fours) + (6 * pl1[i].sixes);

if (pl3.max_run < pl1[i].runs)

pl3.max_run = pl1[i].runs;

if (pl3.max_six < pl1[i].sixes)

pl3.max_six = pl1[i].sixes;
23 | P a g e
}

if (pl3.max_four < pl1[i].fours)

pl3.max_four = pl1[i].fours;

if (pl4.max_w < pl2[i].wkttkn)

pl4.max_w = pl2[i].wkttkn;

printf("Highest runs scored by the batsman:%d\n", pl3.max_run);

printf("Maximum fours scored by the batsman:%d\n", pl3.max_four);

printf("Maximum sixes scored by the batsman%d:\n", pl3.max_six);

printf("Maximum wickets taken by the bowler:%d\n", pl4.max_w);

break;

case 5:

exit(1);

default:

printf("Enter the correct choice\n");

break;

24 | P a g e
} while (choice != 5);

return 0;

25 | P a g e
CHAPTER – 3

EXPECTED RESULTS AND OUTPUT

Sample Output Display

24 | P a g e
CHAPTER – 4

CONCLUSION

The development of the Cricket Scorecard in C program has illustrated the fundamentalaspects

of managing and analyzing cricket match data in a digital environment. By utilizing the

capabilities of the C programming language, this project aimed to replicate the functionalities

of a traditional scorecard, facilitating the tracking and visualization of crucial game statistics.

Throughout the implementation, key features such as player statistics management, dynamic

score tracking, real-time visualization, and statistical analysis were addressed. The program

allowed for the input, manipulation, and display of vital match details, enabling users to

monitor the progress of a simulated cricket match and analyze player and team

performances.

While the provided code serves as a foundational structure, a comprehensive cricket

scorecard demands further expansion and enhancement. Future iterations could incorporate

advanced functionalities, including handling multiple players, comprehensive over-by-over

score updates, tracking wickets, partnerships, team totals, and sophisticated statistical

analysis.

25 | P a g e
SRI RAMAKRISHNA INSTITUTE OF TECHNOLOGY, COIMBATORE-10
(Approved by AICTE, New Delhi – Affiliated to Anna University, Chennai)
(Accredited by NAAC with ‘A’ Grade and All UG Engineering Programmes are
Accredited by NBA)

Department of Science and Humanities

2023 – 2024 Odd Semester

20ITG01 – PROGRAMMING FOR PROBLEM SOLVINGUSING C

I SEM ECE

Project based learning – Evaluation Rubrics

S.No Evaluation Mark Mark


Rubrics
1 Report 35

2 Presentation 35

3 Demo 30

4 Total 100

(A.Jayasmruthi)
Course Coordinator

27 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy