title: Class Rolling Dice program
body: <p>I need to write C program for rolling dice using class Dice. The main requirement is that I need to use this main, editing it:</p>
  
  <pre><code>int main()
  {
        Dice* ptrDice;
               ???
        for (int i = 0; i &lt; 5; i++)
        {
             ????                // roll the 5 dice
             ????                // print the outcome
        }
  }
  </code></pre>
  
  <p>I just cannot get how to use pointers here. Can anyone help, pls?!</p>
  
  <p>Here is my code but it's not working :(</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;cstdlib&gt;
  
  using namespace std;
  
  class Dice{
    public:
      Dice();
      int getNums();
      void Roll();
    private:
      int nNums;
  };
  
  Dice::Dice(){
      nNums=5;
  }
  int Dice::getNums()
  {
      return nNums;
  }
  void Dice::Roll()
  {
      nNums = rand()%6 + 1;
  }
  
  int main()
  {
        Dice* ptrDice = new Dice;
        ptrDice -&gt; getNums();
        for (int i = 0; i &lt; 5; i++)
        {
         getNums[i] = rand()%6 + 1;                // roll the 5 dice
         cout &lt;&lt; "You rolled: ";
         cout &lt;&lt; ptrDice-&gt;getNums() &lt;&lt; setw(4);
         cout &lt;&lt; endl;                             // print the outcome
        }
  }
  </code></pre>
  
  <p>My main trouble is to use that ptrDice and printing it in main function, I guess!</p>