0

Description This program is to be utilized by basketball coaches. The coaches will be able to input a player's points scored over a span of ten games and the program will then output the player’s average.


Program Design.

Declare PointsScored [10] of reals
Declare sum, average as real
Declare B as int
Set sum = 0
For B = 0 1 to 11
Write “Enter players points scored”, B +1
Input PointsScored
Set Sum = Sum + Points Scored (B)
End For
Set Average = Sum/10
For B = 0 Step 1 to 11
Write “The average points scored over ten games”,
End For
Write “The average of points scored over ten games”, Average

3
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by siddhant3s
0

You are almost there:
start of with this:

#include <iostream>
#include <string>
using std::cout;    using std::cin;
using std::string;

int main()
{
    // write the code to Declare PointsScored [10] of reals
    // Reals are represented as 'double' in c++

    // write the code to Declare sum, average as real
    //Write a code to Declare B as int
    //Set sum = 0
    // Construct a for loop: For B = 0 1 to 11 
    //Code for displaying output “Enter players points scored”, B +1
            //output is displayed  cout
    //code to accept input in PointsScored
          //input is done by cin
    // Set Sum = Sum + Points Scored (B)
    // terminate For-block
    //Set Average = Sum/10
//No need of for here just display the Avarage

}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.