Below is the code I am starting with. What is desired is to have the user input the number of players and the number of scores and then populate the players and scores. To check the program out I usually will use random numbers for the scores. My problem is how to set up and access the array of Players[] linked to the array of rawScores[] and populate each. I am thinking of Players.rawScores[j] inside a couple of for loops would suffice. I just need help in the setup and addressing the elements.
Any assistance would be appreciated.
#include <iostream>
#include <conio.h>
using namespace std;
class Person
{
protected:
char *Name;
public:
void SetName(char LastN)
{
strcpy(Name, LastN);
}
};
class Contestant : public Person
{
private:
float *rawScores;
public:
Contestant( )
{
SetName("");
Score = 0;
NumberAttempts = 0;
};
};
int main()
{
int numP, numS;
Contestant *Players;
cout<<"How many Players? ";
cin >>numP;
Players = new Contestant[numP];
cout<<"How many Attempts? ";
cin >>numS;
Players.rawScores = float[numS];
}