ok i got the program written and was wondering how i would write code that will then add all scores together and give the rusult? here my program.

#include <iostream>#include <iomanip>#include <string>using namespace std;const int SIZE = 25;struct Players{       char name[SIZE];        //Player's Name       int playNum;            //Player's Number       double Points;          //Point's Scored};int main(){    const int NUM_PLAYERS = 5; //Number of Players    // Dynamically allocate the memory needed.    Players *players = new Players[NUM_PLAYERS];      //Array of sturctures    int index;                 //Loop    // Get Player data.    cout << "Enter the players by ";    cout << " players, numbers, and their scores.\n";    for (index = 0; index < NUM_PLAYERS; index++)    {        cout << "Please enter players name: ";        cin.ignore();        cin.getline( players[index].name, 25 );        cout << "Please enter players number: ";        ( cin >> players[index].playNum ).get();        cout << "Please enter points scored by player: ";        ( cin >> players[index].Points ).get();    }     //Display the players data    cout << "Here is the players data:\n";    for (index = 0; index < NUM_PLAYERS; index++)    {        cout << "Name: " << players->name << endl;        cout << "Number: " << players->playNum << endl;        cout << "Score: " << players->Points << endl;    }    // Delete the memory.    delete [] players;    return 0;}
This article has been dead for over six months. Start a new discussion instead.