0% found this document useful (1 vote)
291 views

Cricket Score Management Mini Project PDF Free

The document describes a C program for maintaining a cricket score sheet. It defines a structure called "cricket" to store player details like name, team, and batting average. It takes input for number of players and their details in a loop. The details are printed in a tabular format. The user can then search by team name and the players of that team will be displayed. Flowcharts and algorithms are provided to explain the program logic.

Uploaded by

Amit mahi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
291 views

Cricket Score Management Mini Project PDF Free

The document describes a C program for maintaining a cricket score sheet. It defines a structure called "cricket" to store player details like name, team, and batting average. It takes input for number of players and their details in a loop. The details are printed in a tabular format. The user can then search by team name and the players of that team will be displayed. Flowcharts and algorithms are provided to explain the program logic.

Uploaded by

Amit mahi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

SRI RAMAKRISHNA INSTITUTE OF TECHNOLOGY, COIMBATORE-10

An Autonomous Institution
(Approved by AICTE, New Delhi – Affiliated to Anna University, Chennai)
COIMBATORE-10

Department of ELECTRONIC AND COMMUNICATION ENGINEERING

Certified that this is the bonafide Project work done by

HARI PRABHAKAR V , NAKUL SRI KUBER K S in the

UICE004 Computer Fundamentals and C programming

laboratory titled CRICKET SCORE SHEETof this institution, as

prescribed by the Anna University for the FIRST Semester B.E., /

B.Tech., during the year 2019-2020

Register No. 1904014 ,1904039

Staff In-charge
Date:

1
Index

Page
Sl. No. Description
Number

2
If statement :

Syntax of if statement: The statements inside the body of


“if” only execute if the given condition returns true. If the condition
returns false then the statements inside “if” are skipped.

Structure :

Structure is a user-defined datatype in C language which allows us to


combine data of different types together. Structure helps to construct
a complex data type which is more meaningful. It is somewhat similar
to an Array, but an array holds data of similar type only. ...
In structure, data is stored in form of records.

3
Printf statement :

The printf function in C programming language is used for output


formatting. It is used to display information required by the user and
also prints the value of the variables. It formats the output, like the
width of the output, the sign of the output e.t.c We will learn those
formatting using printf() C.

printf(“/n Enter the number of values :”);

Scanf statement :

In the C programming language, scanf is a function that reads


formatted data from stdin (i.e, the standard input stream, which is
usually the keyboard, unless redirected) and then writes the results
into the arguments given.

Scanf(“%d (or) %c (or) %s (or) %f”,&a,&b,&c,&d);

Increment operator :

C programming has two operators increment ++ and decrement -- to


change the value of an operand (constant or variable) by 1. Increment
++ increases the value by 1
It is usally used in for loop and in external program also

4
For(i=0;i<n;i++)

Decrement operator :

Increment and Decrement Operator in C. Increment Operators are


used to increased the value of the variable by one and
Decrement Operators are used to decrease the value of the variable
by one in C programs.
It is usally used in for loop and in external program also

For(i=0;i<n;i--)

Looping Statement in C :

Looping statement are the statements execute one or more statement


repeatedly several number of times. In C programming language there
are three types of loops; while, for and do-while.

Why use loop ?

When you need to execute a block of code several number of times


then you need to use looping concept in C language.

Advantage with looping statement

 Reduce length of Code


 Take less memory space.
 Burden on the developer is reducing.
 Time consuming process to execute the program is reduced.

5
Types of Loops:

There are three type of Loops available in 'C' programming language.

 while loop
 for loop
 do..while

Difference between conditional and looping


statement :

Conditional statement executes only once in the program where as


looping statements executes repeatedly several number of time.

While loop :

In While Loop in C First check the condition if condition is true then


control goes inside the loop body other wise goes outside the body.
while loop will be repeats in clock wise direction.

6
Syntax :
while(condition)
{
Statements;
......
Increment For loop:

For Loop in C is a statement which allows code to be repeatedly


executed. For loop contains 3 parts Initialization, Condition and
Increment or Decrements.

/decrements (++ or --);


}
syntax
for (assign value; decision statement; increment operator
(or)decrement operator )

do-while :
7
A do-while Loop in C is similar to a while loop, except that a do-
while loop is execute at least one time.

A do while loop is a control flow statement that executes a block of


code at least once, and then repeatedly executes the block, or not,
depending on a given condition at the end of the block (in while).
syntax
do
{
Statements;
........
Increment/decrement (++ or --)
} while();
When use do..while Loop :

When we need to repeat the statement block at least 1 time then we


use do-while loop.

8
Nested loop :

In Nested loop one loop is place within another loop body.

When we need to repeated loop body itself n number of times use


nested loops. Nested loops can be design upto 255 blocks.

String :

A string is a sequence of characters stored in a character array.


A string is a text enclosed in double quotation marks. A character
such as 'd' is not a string and it is indicated by single quotation marks.
'C' provides standard library functions to manipulate strings in
a program.

Strcmp() :

The strcmp() function is usedto compare two strings two strings


str1 and str2 . If two strings are same then strcmp() returns 0 ,
otherwise, it returns a non-zero value. This function
compares strings character by character using ASCII value of the
characters.

Goto :

goto is a jumping statement in c language, which transfer


the program's control from one statement to
another statement (where label is defined).

9
PROGRAMING FOF CRICKET SCORE SHEET :

#include<stdio.h>
#include<conio.h>
#include <string.h>
struct cricket
{
char name [100];
char team_name[100];
int batting_average;
};
void main()
{
struct cricket player[200];
int i,n;
char ch,team[100];
printf("HOW MANY PLAYERS\n");
scanf("%d",&n);
for (i=0;i<n;i++)
{
printf("\n INPUT THE NAME OF THE PLAYER %d : ",i+1);
scanf("%s",player[i].name);
printf("\n INPUT THE TEAM NAME OF THE PLAYER %d :",i+1);
scanf("%s",player[i].team_name);
printf("\n INPUT THE BATTING AVERAGE OF THE PLAYER %d
:",i+1);
scanf("%d",&player[i].batting_average);
} printf("=============================================\
n"); printf(" PLAYER'S NAME
COUNTRY BATTING AVERAGE\n");
printf("=============================================\n");
for(i=0;i<=n;i++)
printf(" %20s %20s%d\n",player[i].name, player[i].team_name,
player[i].batting_average);
for(i=0;i<n;i++)
{
printf("\n INPUT THE NAME OF THE PLAYER %d : ",i+1);
scanf("%s",player[i].name);
printf("\n INPUT THE TEAM NAME OF THE PLAYER %d :",i+1);
scanf("%s",player[i].team_name);
printf("\n INPUT THE BATTING AVERAGE OF THE PLAYER %d
:",i+1);

10
scanf("%d",&player[i].batting_average);

printf("===================================================
=====\n");
printf(" PLAYER'S NAME COUNTRY BATTING
AVERAGE\n");
printf("===================================================
======\n");
for(i=0;i<=n;i++)
printf(" %20s %20s%d\n",player[i].name, player[i].team_name,
player[i].batting_ average);
for(i=0;i<n;i++)
{
printf("\n INPUT THE NAME OF THE PLAYER %d : ",i+1);
scanf("%s",player[i].name);
printf("\n INPUT THE TEAM NAME OF THE PLAYER %d :",i+1);
scanf("%s",player[i].team_name);
printf("\n INPUT THE BATTING AVERAGE OF THE PLAYER %d
:",i+1);
scanf("%d",&player[i].batting_average);

} printf("================================================\

n");
printf(" PLAYER'S NAME COUNTRY BATTING AVERAGE\n");
printf("==============================================\n");
for(i=0;i<=n;i++) printf("%20s%d\
n",player[i].name,player[i].team_name,player[i].batting_avera ge);
read:
printf("\n\n INPUT FOR WHICH TEAM YOU WANT TO LIST : ");
scanf("%s",team);
printf("\n %s \n",team);
printf("===========================================\n=");
printf(" PLAYER'S NAME BATTING AVERAGE \n");
printf("===========================================\n=");
for(i=0;i<=n;i++)

printf(“%20s%20s%d\n",player[i].name,player[i].team_name,player[i].batting_
average);
printf(" \n\n DO YOU WANT TO LIST ANY OTHER TEAM ? (Y/N) : ");

11
ch=getch();
if (ch == 'Y' || ch == 'y')
goto read;
getch();
}

OUITPUT :

THE PROGRAM IS VERRIFIED AND WORK PROPERLY


WITHOUT MISTAKE’S.

PROGRAM OUTPUT IN PC :

12
13
14
FLOWCHART FOR PROGRAM :

15
16
17
ALGORITHM :

Step1:START
Step2:Declare structure cricket .
Name as string.
Team name as string .
Batting average as integer .
Step3:Declare i,n and team name
Step4:Print “how many players” and get the value
of ‘n’
Step5:Get the names, team names and the batting
averages
Step6:Print the names, team names and batting
averages
Step7:Form a team using the data
Step8:Print the team players and average
Step9:Stop

18
19
20
21

You might also like