title: Is there a way to input different value for the same data when the same function is called multiple times?
body: <p>I'm creating a student data management program in C++ and the function to insert examination marks is buggy.</p>
  
  <p>The code given below is enough to recreate the buggy part of the program.</p>
  
  <ul>
  <li>I have tried to increase the size of <code>sub[]</code> to 16</li>
  <li>I have tried to insert data one after the other instead of a loop</li>
  </ul>
  
  <p>None of the above seem to solve the problem</p>
  
  <p>Menu function:</p>
  
  <pre><code>char ch;
  main_menu:
  clrscr();
  cout &lt;&lt; "Press the key for your choice:\n";
  cout &lt;&lt; "D -&gt; Edit details\n";
  cout &lt;&lt; "R -&gt; Get result\n";
  cout &lt;&lt; "I -&gt; Insert marks\n";
  cout &lt;&lt; "E -&gt; Exit Program";
  
  choice:
  ch = getch();
  switch(ch)
  {
  case 'd':   
      //edit_nam();           Ignore this one
      goto main_menu;
      break;
  
  case 'i':
      ins_mar();
      goto main_menu;
      break;
  
  case 'r':
      //get_res();           This one is not related to the problem
      goto main_menu;
      break;
  
  case 'e':
      break;
  
  default:
          goto choice;
  }
  </code></pre>
  
  <p>Insert marks function:</p>
  
  <pre><code>for(int i = 0; i &lt; 6; i++)
  {
  clrscr();
  cout &lt;&lt; "Enter details of subject:" &lt;&lt; i + 1;
  cout &lt;&lt; "\nSubject name:";
  cout &lt;&lt; "\nMarks:";
  gotoxy(14, 1);
  cin.getline(student.marks[i].sub, 8);
  gotoxy(7,2);
  cin &gt;&gt; student.marks[i].mark;
  
  (i != 5) ? cout &lt;&lt; "\nPress any key to continue..." : cout &lt;&lt; "\nPress any key to return to menu...";
  getch();
  }
  </code></pre>
  
  <p>Student structure:</p>
  
  <pre><code>struct stu
  {
      char name[20];
  int ID;
  int cls;
  mar marks[6];
  };
  </code></pre>
  
  <p>Marks structure:</p>
  
  <pre><code>struct mar
  {
      char sub[8];
      float mark;
  }
  </code></pre>
  
  <p>If the code was working fine, then it would ask the user to enter the marks for all six subjects, every time the function is called in one run.</p>
  
  <p>However, It is not so. In the first time of function call, everything happens in the correct manner, but it does not ask for subject name after first subject in any of the other runs.</p>