FIFA-2022 Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
in GTU B.E. (CSE-I-Sem) Programming For Problem Solving Lab by Goeduhub's Expert (7.1k points)

Define a structure called cricket that will describe the following information:

Player name

Team name

Batting average

Using cricket, declare an array player with 50 elements and write a C program to read the information about all the 50 players and print team wise list containing names of players with their batting average.

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.1k points)
edited by
Best answer

In this program we are going to implement a structure called cricket which will hold three members as player name, team name, batting average. We will take input of these information from user and then print it to output window.

To learn about structure and union from beginning Click Here.

Example :


//Declaration of structure name cricket
struct cricket{

//Declaration of structure member variables
char player_name[30],team_name[30];
int bat_avg;

void main()
int i,n;

//To store information of as much players as much required
printf("\nEnter the number of players you want to include:");

//To store information of players
printf("\nEnter the following information related to players");
printf("\nPlayer %d Name:",i+1);
printf("\nTeam Name:");
printf("\nBatting average:");

//To print information of players
printf("\nEntered Information:");
printf("\n|| S.No. ||  Player Name      ||    Team Name    ||   Batting Average  ||");
printf("\n||  %d    ||   %s             ||       %s        ||          %d     ||",i+1,player[i].player_name,player[i].team_name,player[i].bat_avg);

Output :

Output of above program showing structure operation

For More GTU C Programming Lab Experiments Click Here

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs


About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © Social::   |  | 


Free Online Directory