title: C++ what should I use instead of #define
body: <p>I would like to give a value from the console with cin operator instead of using a #define N 6.
  I've tried it but I get "expression must have constant value" error message.
  How should I do it by the other way?</p>
  
  <p>Thank you for answers!</p>
  
  <p>Example code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstdlib&gt; 
  #include &lt;ctime&gt;
  #define N 6
  using namespace std;
  
  typedef struct person {
      int roll;
      string name;
  } Person;
  
  int main() {
      int numberofperson;
      cout &lt;&lt; "Number of people: "; cin &gt;&gt; numberofperson;
      srand(time(NULL));
      Person people[N];
      int i;
      for (i = 0; i &lt; numberofperson; i++)    {
          cout &lt;&lt; "Write the " &lt;&lt; i + 1 &lt;&lt; ". name of the person: ";
          cin  &gt;&gt; people[i].name;
          people[i].roll = rand() % 6 + 1;
          cout &lt;&lt; "Roll with dice: " &lt;&lt; people[i].roll&lt;&lt;endl;
      }
  
      return 0;
  }
  </code></pre>