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;}

OMG: do you really write your code all on one line like that!:eek: I'll bet your teacher is very proud of your coding style.

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.