title: Ballot counting nested loop confusion
body: <p>Question:
  Suppose a new member of the city council has to be chosen from three candidates and suppose there are 4 voting stations. We need a C++ program that will count the votes for every candidate and display the result. At every voting station the voters vote by choosing A, B or C on a ballot paper. The voting officer must enter the votes into the program so that they can be counted. X is entered when all the votes at a specific voting station have been entered.</p>
  
  <p>-Use a for loop from 1 to the number of voting stations.</p>
  
  <p>-Inside the for loop is a while loop prompting the user who they want to vote for.</p>
  
  <p>-Inside the while loop is a switch statement to increment the total and default to count spoilt votes.</p>
  
  <p>-The while loop is exited when an X is entered for the choice.</p>
  
  <p>-When the for loop is exited, the three totals and number of spoilt votes are displayed.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      const int VOTING_STATIONS = 4;
      int votesForA = 0, votesForB = 0, votesForC = 0, spoiltVotes = 0;
      char vote;
      int  numVotes;
  
  
      for (int i = 0; i &lt;= VOTING_STATIONS; i++)
      {
          numVotes = 0;
  
          while (vote != 'X')
          {
  
              cout &lt;&lt; "Which candidate do you want to choose?:" &lt;&lt; endl;
              cin &gt;&gt;vote;
  
  
              switch(vote)
              {
                  case 'A':
                  votesForA++;
                  break;
                  case 'B':
                  votesForB++;
                  break;
                  case 'C':
                  votesForC++;
                  break;
                  case 'X':
                  break;
                  default:
                  spoiltVotes++;
                  break;
  
               }
           }
      }
  
      // display results
      cout &lt;&lt; "Total candidate A: " &lt;&lt; votesForA &lt;&lt; endl;
      cout &lt;&lt; "Total candidate B: " &lt;&lt; votesForB &lt;&lt; endl;
      cout &lt;&lt; "Total candidate C: " &lt;&lt; votesForC &lt;&lt; endl;
      cout &lt;&lt; "Total spoilt votes: " &lt;&lt; spoiltVotes &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>In the end im just completly lost with this program and i dont know what to do anymore. Any help is greatly appreciated.</p>