title: using while loop to create objects
body: <p>The biggest issue I am dealing with is in my main.cpp file however I posted my video.h file and video.cpp file just in case. </p>
  
  <p>I am having a difficult time understanding the concept of reading input and then creating an object.</p>
  
  <p>I have a class Video that contains the member functions needed to create an object. My class works fine . In my main I want to be able to read the input before I create the object rather than creating an object then initializing the variables.</p>
  
  <p>video.h</p>
  
  <pre><code>#ifndef VIDEO_H
  #define VIDEO_H
  #include&lt;iostream&gt;
  #include&lt;string&gt;
  using namespace std;
  
  class Video{
  
    public:
  
  // constructor works fine
      Video(string name, string link, string comment,
          double rating, int stars);
      void print();
  
  
  
  
  // member variables
    private:
  
      string m_name;
      string m_link;
      string m_comment;
      double m_rating;
      int m_stars;
  
  };
  
  #endif
  </code></pre>
  
  <p>video.cpp</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include "video.h"
  using namespace std;
  
  
  Video :: Video (string name, string link, string comment,
                  double rating, int stars){
  
  
    m_name = name;
    m_link = link;
    m_comment = comment;
    m_rating = rating;
    m_stars = stars;
  }
  
  void Video :: print (){
  
    cout &lt;&lt; m_name &lt;&lt; ", " &lt;&lt; m_link &lt;&lt; ", " &lt;&lt; m_comment &lt;&lt; ", " &lt;&lt;
      m_rating &lt;&lt; ", ";
  
  for(int count = 0; count &lt; m_stars; ++count){
  
    cout &lt;&lt; "*";
  //cout &lt;&lt; endl;
  }
  cout &lt;&lt; endl;
    //&lt;&lt; " , " &lt;&lt; m_stars &lt;&lt; endl;
  
  
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  #include "video.h"
  
  int main()
  
  /*  My program can create objects and initialize the string variables
     if the data is hard-coded when the object is created however I want
     read data using cin and a while loop then create an object.
      Video video1("Title One", "www.youtube.com/one", 
                             "Comment ONE", 1.1, 1);
      Video video2("Title Two", "www.youtube.com/two", 
                             "Comment TWO", 2.2, 2);
  
      video1.print();
      video2.print();
  */
  {
  
    while (Video &gt;&gt; cin) { //I want to use a while loop here
      /* The program needs to read these getlines 
         and other variables in order to store names or comments 
         that have spaces */
  
  
      getline(cin, name); // user enters the name then presses "enter"
      getline(cin, link); // user enters the link then presses "enter"
      getline(cin, comment); // user enters the comment then presses "enter"
      double rating; // user enters the rating then presses "enter"
      int stars; // user enters the amount of stars then presses "enter"
      Video video_one; /* Once the user enters data for all five members a new object is created */
    }
  
  
  
  }
  </code></pre>