Keeping Score and Declaring a Winner Assistance in Word Game
<p>I've gotten most of this down, but there's only two things that are still getting me and a little push in the right direction can be oh so helpful. I'm supposed to be creating a word game with players and rounds and then at the end it should total up the scores and declare a winner. I've been able to get everything working except for tallying up the scores and declaring a winner. I've been able to have them show how many points a person earns each round, but I can't seem to have the totals carry over to each round. I've tried various things but I can't seem to get it. Any help going in the right direction would be greatly appreciated! </p>

<p>Edit: I also tried to add: </p>

<pre><code>total_points[player_counter][round_counter] = input_word.length();  
</code></pre>

<p>to my code, but it gave me an "expression must have a pointer-to-object type" for only player_counter, so I don't know where to add something in to make that go away.</p>

<p>Full Code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;ctime&gt;
#include &lt;cstdlib&gt;
using namespace std;

int round_number;
int scores;
int players;
int player_scores;
string input_word;
int player_counter = 0;
int total_points = 0;
int winner = 0;
int win;

int main()
{
cout &lt;&lt; "Welcome to the Word Game!" &lt;&lt; endl &lt;&lt; endl;

cout &lt;&lt; "How many players will be participating?" &lt;&lt; endl;
cin &gt;&gt; players;

cout &lt;&lt; "\nHow many rounds will be played?" &lt;&lt; endl;
cin &gt;&gt; round_number;
cin.ignore();

srand(time(0));

for (int round_counter = 1; round_counter &lt;= round_number; round_counter++)
{
    cout &lt;&lt; "\nRound: " &lt;&lt; round_counter &lt;&lt; endl;

    for (int player_counter = 1; player_counter &lt;= players; player_counter++)
    {
        char beginning_letter = (rand() % 26) + 'a';

        cout &lt;&lt; "\nPlayer " &lt;&lt; player_counter &lt;&lt; ": Please enter a word that begins with: " &lt;&lt; beginning_letter &lt;&lt; endl;
        getline(cin, input_word);

        cout &lt;&lt; "Player " &lt;&lt; player_counter &lt;&lt; " has earned: " &lt;&lt; input_word.length() &lt;&lt; " points." &lt;&lt; endl;

        total_points = input_word.length();
        cout &lt;&lt; "\nPlayer " &lt;&lt; player_counter &lt;&lt; " Points: " &lt;&lt; total_points &lt;&lt; endl;
    }

}

cout &lt;&lt; "\nThese are the end results!";

int sum = 0;
for (int end_score = 0; end_score &lt; total_points; ++end_score)
{
    sum += total_points;
    end_score = total_points;

    for (int player_counter = 1; player_counter &lt;= players; player_counter++)
    {
        cout &lt;&lt; "\nPlayer " &lt;&lt; player_counter &lt;&lt; " Points: " &lt;&lt; end_score &lt;&lt; endl;
    }
}

cout &lt;&lt; "Player " &lt;&lt; player_counter &lt;&lt; " is the winner!" &lt;&lt; endl;

system("PAUSE");
</code></pre>