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

Recommended Answers

All 2 Replies

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

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.