title: Loop to get user input using cstring array c++
body: <p>I have an assignment that requires me to write a program that prompts the user to enter the name of a student and their grade and keeps looping until they enter "quit". </p>
  
  <p>But I can't figure out how to get the user input for the array to get the entire line (which is a first &amp; last name so I can't just do cin >> name1[i] since theres white space) but when I use cin.getline or just getline and compile it, I get an error message saying No member function matching getline. </p>
  
  <p>Also when I compile it without getline, its just a continuous loop and doesnt let me input any info for name or grade. I'm new to arrays and cstring so please try to dumb down where I'm messing up. Thank you.  </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstring&gt;
  #include &lt;cctype&gt;
  
  using namespace std;
  
  int main() {
  
      const int CAPACITY = 50;
      string name1[CAPACITY];
      string grade[CAPACITY];
      char quit[]= "quit";
      int i;
  
      //for loop to get names and grades from user until quit is entered
      for (i = 0; i &lt; CAPACITY; i++) {
          while (name1[i] != quit)
              cout &lt;&lt; "Please input a name (or 'quit' to quit): ";
              getline(cin, name1[i]);
  
      //break if name1[i] = quit 
      if (name1[i].compare(quit) == 0) {
          break;
      }
  
      //continue loop if quit not entered and get the grade from that person
      cout &lt;&lt; "Please input this person's grade: ";
      cin &gt;&gt; grade[i];
      }
  
      return 0;
  
  }
  </code></pre>