Write a C program to get information about the basketball teams according to the entered values that will be stored using arrays. The National Basketball Association (NBA) is a professional basketball league that is composed of maximum 5 teams. You have to create an array enough for all the team numbers range from 1 to 5. Then, you need to create a function caleScore() that calculates the score of the team by getting the current points of a team and loosing game number information. The score is calculated as seen below: score=pts-loosingGame; > The calcScore() function takes an integer and integer pointer as formal parameters, and returns the score value under a parameter. The score variable should be printed in the main function as shown in the Sample Run 1. ➤ The array Result() function adds results into another array, and output these results as "Added a result array as a score". (see Sample Run 1). > Another function called findmaxScore() determines the maximum result among the related teams. And then, print "Team (#ofteam) gets as a score" within this. function. In your main program, 1/3 You have to create the required array/s. ➤You should call the function calcScore(). Then, print these results under the main function as shown in the Sample Run 1. You should call the arrayResult() function. ➤You should call the findmaxScore() function to find the maximum score and print the maximum score together with its related team number on the screen. You must write the necessary codes to provide the Sample Run outputs. Your codes should work for different inputs. Please consider the sample run given below. Sample Run 1: Enter the team number: 1 Enter the points and loosing game: 12 2 Score is: 10 Added a result array as a score 10 Enter the team number: 2 Enter the points and loosing game: 24 4 Score is: 28 Added a result array as a score 20 Enter the team number: 3 Enter the points and loosing game: 13 2 Score is: 11 Added a result array as a score 11 Enter the team number: 4 Enter the points and loosing game: 155 1/3
Write a C program to get information about the basketball teams according to the entered values that will be stored usin
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Write a C program to get information about the basketball teams according to the entered values that will be stored usin
Write a C program to get information about the basketball teams according to the entered values that will be stored using arrays. The National Basketball Association (NBA) is a professional basketball league that is composed of maximum 5 teams. You have to create an array enough for all the team numbers range from 1 to 5. Then, you need to create a function caleScore() that calculates the score of the team by getting the current points of a team and loosing game number information. The score is calculated as seen below: score=pts-loosingGame; > The calcScore() function takes an integer and integer pointer as formal parameters, and returns the score value under a parameter. The score variable should be printed in the main function as shown in the Sample Run 1. ➤ The array Result() function adds results into another array, and output these results as "Added a result array as a score". (see Sample Run 1). > Another function called findmaxScore() determines the maximum result among the related teams. And then, print "Team (#ofteam) gets as a score" within this. function. In your main program, 1/3 You have to create the required array/s. ➤You should call the function calcScore(). Then, print these results under the main function as shown in the Sample Run 1. You should call the arrayResult() function. ➤You should call the findmaxScore() function to find the maximum score and print the maximum score together with its related team number on the screen. You must write the necessary codes to provide the Sample Run outputs. Your codes should work for different inputs. Please consider the sample run given below. Sample Run 1: Enter the team number: 1 Enter the points and loosing game: 12 2 Score is: 10 Added a result array as a score 10 Enter the team number: 2 Enter the points and loosing game: 24 4 Score is: 28 Added a result array as a score 20 Enter the team number: 3 Enter the points and loosing game: 13 2 Score is: 11 Added a result array as a score 11 Enter the team number: 4 Enter the points and loosing game: 155 1/3