Somebody help me build this program, its sort of challenging...Instructions say to store player's name, number and points scored by each player...Program should keep an array of 12 of these structures, each element is for a different player ona team...program should ask user to enter the data above for each player...It should show a table that lists each player's number, name and points scored... It should calculate and display total points earned by team. Number and name of player that earmed the most points should be displayed...

This is what I have:

#include <iostream>
using namespace std;

const int PLAYER_SIZE=40;

struct soccerData
{
	int numberPlayer;
	int pointsScored;
	char description[PLAYER_SIZE];
};
int main()
{
	const int NUM_PLAYERS=12;
	soccerData players[NUM_PLAYERS];
	int index;

	//Ask info
	cout<< "Enter names, numbers, and points: "<<NUM_PLAYERS;
	for (index=0; index<NUM_PLAYERS; index++)
	{
		//get name
		cout<< "Players name "<<(index+1);
		cout<< ": ";
		cin>> players[index]. numberPlayer;
		//get points
		cout<< "Points scored "<<(index+1);
		cout<<": ";
		cin>>players[index].pointsScored;
		//get numbers
		cout<<"Player's name "<<(index+1);
		cout<<": ";
		cin>>players[index].numberPlayer;
	}
//Display
	cout<<"Total points:\n";
	for(index=0; index<NUM_PLAYERS; index++)
	{
		double total;
		total=players[index].pointsScored*12;
		cout<<"Total points "<<(index+1);
		cout<<": "<<total<<endl;
	}
	return 0;
}

I get stuck after this...

What I get from the instructions is that each structure should be for a different player...also that loops should be involved...loops should ask the user the questions needed...

Help me make this program please!!?

You are almost done! :) All you have to do now is calculate the total points earned by the team and keep track of who earned to most points.

Can somebody help me find the highest scorer and the name of the person that scored the highest? This is what I have so far...

#include <iostream>
using namespace std;

const int PLAYER_SIZE=40;
void getData(soccerData *);
struct soccerData
{
	int numberPlayer;
	int pointsScored;
	char namePlayer[PLAYER_SIZE];
	int highestScore;
	int nameHighest;
};

int main()
{
	const int NUM_PLAYERS=12;
	soccerData players[NUM_PLAYERS];
	int index;
	

	//Ask info
	cout<< "Enter names, numbers, and points. "<<endl;
	
	for (index=0; index<NUM_PLAYERS; index++)
	{
		//get name
		cout<< "Players name "<<(index+1);
		cout<<": ";
		cin>> players[index].namePlayer;

		//get points
		cout<< "Points scored "<<(index+1);
		cout<<": ";
		cin>>players[index].pointsScored;

		//get numbers
		cout<<"Player's number "<<(index+1);
		cout<<": ";
		cin>>players[index].numberPlayer;
	}

//Display
	
	for(index=0; index<1; index++)
	{
		double total;
		total=players[index].pointsScored;
		cout<<"Total points ";
		cout<<": "<<total*12<<endl;
	}

	return 0;
}
void getData(soccerData*)
{
	highestScore = pointsScored[0];
for (int count =1; count < NUM_PLAYERS;count++)
	{
		if (pointsScored[count]> highestScore)
			
				highestScore = pointsScored[count];
				nameHighest = count;
			
	}
	cout<<" The highest scorer is "<< PLAYER_SIZE[nameHighest] << " : "<<highestScore<<endl;
}

Somebody fix it for me?

#include <iostream>
using namespace std;

const int PLAYER_SIZE=40;
const int NUM_PLAYERS=4;
struct soccerData;
//void getData(soccerData *);

struct soccerData
{
	int numberPlayer;
	int pointsScored;
	char namePlayer[PLAYER_SIZE];
};

int main(){
soccerData players[NUM_PLAYERS];
soccerData winner;

double highestGoals = -1;

//Ask info
cout<< "Enter names, numbers, and points. "<<endl<<endl;

for (int index=0; index<NUM_PLAYERS; index++){
	//get name
	cout<< "Players name "<<(index+1);
	cout<<": ";
	cin>> players[index].namePlayer;

	//get points
	cout<< "Points scored "<<(index+1);
	cout<<": ";
	cin>>players[index].pointsScored;

	//get numbers
	cout<<"Player's number "<<(index+1);
	cout<<": ";
	cin>>players[index].numberPlayer;
	cout<<endl<<endl;
}

//Display

	for(int index = 0; index < NUM_PLAYERS; index++){
		if(players[index].pointsScored > highestGoals){
			highestGoals = players[index].pointsScored;
			winner = players[index];
		}
	}
	cout<<"Winner is "<<winner.namePlayer<<" "<<"and he scored "<<highestGoals<<" goals "<<endl;
	return 0;
}

thanks, but I had the total...What happened to the total? could u fix it? thanks

My guess is that you did not write the code you posted but copied it from someone else (plagiarism comes to mind). If you had written it then you would know how to finish the problem.

actually i wrote it myself... your negative and untrue comments are not any help at all...

Then if you did write it (I'll believe you for now) why are you begging someone to finish it for you? Surely you are smart enough to do it yourself. I already told you there are only two things left to do. So get to doing them. We don't mind answering questions about what or how to do it, but please don't ask us to finish the program for you.

>>actually i wrote it myself... your negative and untrue comments are not any help
>>at all...
They are actually helpful. These comments might not solve this problem, but it will help you in long run.
Copying the code which you don't understand is not expected from a good programmer. There is however one exception to this : Libraries. When you use libraries (like iostream or string) you are actually copying the code but that is perfectly desirable since you are not expected to know what is going behind the scene.

You said that your friend helped you build this code. Here 'helped' simply does not have any meaning. It may be that he actually wrote the whole code !!.
You should perhaps try to find that friend and ask him how this thing works.

Here on Daniweb, we stricktly are against 'code wanters' (like you) and 'code givers' ( like vsha).

Read :
http://www.daniweb.com/forums/announcement8-2.html
http://www.daniweb.com/forums/thread78223.html

Also note that your current program is very trivial for most of the programmers here. So if you think by any means that we don't have enough knowledge to solve this, you're wrong. We are helping you ( by criticizing ) and sooner or later you would find that this is a big help.
Ancient Dragon has already guide you enough on post #2. If you cannot follow his advice, perhaps you should read your textbook thoroughly.

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.