title: how to show the time using time class and function
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;ctime&gt;
  
  using namespace std;
  
  class time
  {
      protected:
          int hr;
  
      public:
          void settime()
          {
              time_t now = time(0);
              tm *ltm = localtime(&amp;now);
              display(1 + ltm-&gt;tm_hour);
          }
          void display(int a)
          {
              hr=a;
              cout&lt;&lt;hr;
          }
  };
  int main( )
  {
       time t;
       t.settime();
  
       return 0;
  }
  </code></pre>
  
  <p>The question is like this: 
  Provide a constructor that is capable of using the current time from the time() function - declared in the C standard Library header time.h - to initialize an object of the time class. 
  I not so understand about the class and is it this way is true. 
  Can anyone help me ? </p>