title: Structures, Functions and arrays
body: <p>Program details: Program will display menu which will have 4 options </p>
  
  <ol>
  <li>New Enrollment of student </li>
  <li>editing students detail </li>
  <li>Updating details </li>
  <li>Show list of all students</li>
  </ol>
  
  <p>If enrollment exceeds 45 it should give a message. There should be use of structures and functions. separate function for enrollment, edit and update so goes on. I have question from the code I have written. I am having confusion on how to use structure with function. I donot know if I am right or wrong. How to use pointers in this situation??</p>
  
  <p>My updated code but still giving weird output, How to use functions with pointer when we are storing multiple data like in this code Data data[45].</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cctype&gt;
  #include &lt;cstring&gt;
  using namespace std;
  
  
  struct Date{
  int day;
  int month;
  int year;
  
  
  };
  
  struct Data{
  int id;
  char firstName[20];
  char lastName[20];
  float PrimaryMarks;
  float secondaryMarks;
  Date date;
  };
  
  
  
  void enrollment(Data *dtai){
          static int i=0;
  
          if(i&lt;45){
          dtai-&gt;id=i+1;
  
  
          cout&lt;&lt;"Enter the student's First Name"&lt;&lt;endl;
          cin&gt;&gt;dtai-&gt;firstName;
  
  
          cout&lt;&lt;"Enter the student's Last Name"&lt;&lt;endl;
          cin&gt;&gt;dtai-&gt;lastName;
  
          cout&lt;&lt;"Enter the student's Primary School Percentage"&lt;&lt;endl;
          cin&gt;&gt;dtai-&gt;PrimaryMarks;
  
  
          cout&lt;&lt;"Enter the student's Secondary School Percentage"&lt;&lt;endl;
          cin&gt;&gt;dtai-&gt;secondaryMarks;
  
  
          cout&lt;&lt;"Enter the day of enrollment"&lt;&lt;endl;
          cin&gt;&gt;dtai-&gt;date.day;
  
          cout&lt;&lt;"Enter the month of enrollment"&lt;&lt;endl;
          cin&gt;&gt;dtai-&gt;date.month;
  
          cout&lt;&lt;"Enter the year of enrollment"&lt;&lt;endl;
          cin&gt;&gt;dtai-&gt;date.year;
          }
  
  i++;
  }
  
  
  int main(){ 
  //taking students information menu display
  Data data[45];
  
  //int i=0;
  int option;
  char sentinal;
  
  do{ 
  
  int x=0;
  //display menu
  cout&lt;&lt;"Press 1 for New Enrollment"&lt;&lt;endl;
  cout&lt;&lt;"Press 2 for editing student's detail"&lt;&lt;endl;
  cout&lt;&lt;"Press 3 for updating student's detail"&lt;&lt;endl;
  cout&lt;&lt;"Press 4 to see list of students"&lt;&lt;endl;
  
  cin&gt;&gt;option;    
  
      switch(option){
          case 1:
  
              enrollment(&amp;data[x]);
              break;
          case 2:
  
          case 4:
  
  
      }
  
  
  
  
  cout&lt;&lt;"Press m to go to the menu again ";
  cin&gt;&gt;sentinal;
  
  }while(sentinal=='m');
  
  
  
  return 0;
  }
  </code></pre>
  
  <ol>
  <li>Please tell me how to use structures with functions for multiple data.</li>
  </ol>
  
  <p>I have just written my code for 1st option enrollment rest are remaining, Please answer my above question Thanks in advance</p>