Method of storing a date
<p>I was wondering if there is a way to get a date without writing your own function. Something such as accessing the date set for the system. I tried</p>

<pre><code>char dateStr[9];
_strdate(dateStr);
</code></pre>

<p>with the included time header, but I got compiler error ISO C++ forbids declaration of _strdate with no type. I thought _strdate was already declared and defined in the header so it wouldn't need a type definition. Could the problem be that I have those 2 lines inside of a struct? Are there any better way to store a date? Thanks.</p>

<pre><code>#include "std_lib_facilities.h"

//Classes-----------------------------------------------------------------------

class Book{
public:
       Book(){}; // default constructor
       //operators
       friend ostream&amp; operator&lt;&lt;(ostream&amp; out, const Book&amp; val);
       bool Book::operator==(const Book&amp; check);
       //member functions
       string title();
       string author();
       string genre();
       int copyright();
       void ISBN();
       bool checkout();
private:
        string title_;
        string author_;
        string genre_;
        int copyright_;
        int ISBN1;
        int ISBN2;
        int ISBN3;
        char ISBN4;
        bool checkout_;
};

class Patron{
public:
       Patron(){}; //default constructor
       //member functions
       string name();
       int libnumber();
       double setfee();
private:
        string name_;
        int libnumber_;
        double libfees;
};

class Library{
public:
       vector&lt;Book&gt; books;
       vector&lt;Patron&gt; patrons;
       struct Transaction{
              Book book;
              Patron patron;};
       vector&lt;Transaction&gt; transactions;
};
// Error Function---------------------------------------------------------------

void _error(const string&amp; s)
{
     cout &lt;&lt; endl;
     cout &lt;&lt; "Error: " &lt;&lt; s &lt;&lt; endl;
     cout &lt;&lt; endl;
}

// Book Member Functions--------------------------------------------------------

string Book::title()
{
       cout &lt;&lt; "Title: ";
       getline(cin,title_);
       cout &lt;&lt; endl;
       return title_;
}

string Book::author()
{
       cout &lt;&lt; "Author: ";
       getline(cin,author_);
       cout &lt;&lt; endl;
       return author_;
}

string Book::genre()
{
       cout &lt;&lt; "Genre(Fiction, Nonfiction, Periodical, Biography, Children): ";
       cin &gt;&gt; genre_;
       cout &lt;&lt; endl;
       if((genre_!="Fiction")&amp;&amp;(genre_!="Nonfiction")&amp;&amp;(genre_!="Periodical")&amp;&amp;
          (genre_!="Biography")&amp;&amp;(genre_!="Children")) _error("Invalid genre.");
       else return genre_;
}

int Book::copyright()
{
    cout &lt;&lt; "Copyright: ";
    cin &gt;&gt; copyright_;
    cout &lt;&lt; endl;
    return copyright_;
}

void Book::ISBN()
{
     cout &lt;&lt; "ISBN (4 entries. Use spaces): ";
     cin &gt;&gt; ISBN1 &gt;&gt; ISBN2 &gt;&gt; ISBN3 &gt;&gt; ISBN4;
     if((ISBN1&lt;0) || (ISBN2&lt;0) || (ISBN3&lt;0) || (ISBN1&gt;9) || (ISBN2&gt;9) || (ISBN3)&gt;9)
               _error("Must be single digit.");
     else if(!isdigit(ISBN4) &amp;&amp; !isalpha(ISBN4))
               _error("Must be single digit or letter.");
     else{ cout &lt;&lt; endl;
           return;}
}

bool Book::checkout()
{
     char check;
     cout &lt;&lt; "Checked out?(Y or N): ";
     cin &gt;&gt; check;
     switch(check){
     case 'Y':
          cout &lt;&lt; endl;
          return true;
          break;
     case 'N':
          cout &lt;&lt; endl;
          return false;
          break;
     default: 
              _error("Must be Y or N.");}
}

// Patron Member Functions------------------------------------------------------

string Patron::name()
{
       cout &lt;&lt; "Name: ";
       getline(cin,name_);
       cout &lt;&lt; endl;
       return name_;
}

int Patron::libnumber()
{
    cout &lt;&lt; "Libnumber: ";
    cin &gt;&gt; libnumber_;
    cout &lt;&lt; endl;
    return libnumber_;
}

double Patron::setfee()
{
       cout &lt;&lt; "Fee due: ";
       cin &gt;&gt; libfees;
       cout &lt;&lt; endl;
       return libfees;
}

// Patron Helper Functions------------------------------------------------------

bool isfee()
{
     char isfee_;
     cout &lt;&lt; "Does patron have fee due?(Y or N): ";
     cin &gt;&gt; isfee_;
     cout &lt;&lt; endl;
     if((isfee_!='Y') &amp;&amp; (isfee_!='N')) _error("Must use Y or N.");
     else return(isfee_=='Y');
}

// Operator Overloads-----------------------------------------------------------

ostream&amp; operator&lt;&lt;(ostream&amp; out, const Book&amp; val){
         out &lt;&lt; "Title: " &lt;&lt; val.title_ &lt;&lt; endl;
         out &lt;&lt; "Author: " &lt;&lt; val.author_ &lt;&lt; endl;
         out &lt;&lt; "ISBN: " &lt;&lt; val.ISBN1 &lt;&lt; "-" &lt;&lt; val.ISBN2 &lt;&lt; "-" &lt;&lt; val.ISBN3 &lt;&lt; "-" &lt;&lt; val.ISBN4 &lt;&lt; endl;
         out &lt;&lt; endl;
         return out;}

bool Book::operator==(const Book&amp; check){
     return((ISBN1 == check.ISBN1) &amp;&amp; (ISBN2 == check.ISBN2) &amp;&amp; (ISBN3 == check.ISBN3)
             &amp;&amp; (ISBN4 == check.ISBN4));}

// Main Helpers-----------------------------------------------------------------

void runBook()
{
     Library bookstore;
     char notfinished;
     bool bookfinished = false;
     while(!bookfinished)
        {
          Book book;
          book.title();
          book.author();
          book.genre();
          book.copyright();
          book.ISBN();
          book.checkout();
          bookstore.books.push_back(book);
          cout &lt;&lt; "Do you wish to store another book?(Y or N): ";
          cin &gt;&gt; notfinished;
          if(notfinished == 'Y'){ 
                         cin.ignore();
                         cout &lt;&lt; endl;}
          else if(notfinished == 'N'){
                                       bookfinished = true;
                                       cout &lt;&lt; endl;}
          else _error("Must be Y or N");
          }
}

void runPatron()
{
     Library patronstore;
     bool patronfinished = false;
     char notfinished;
     while(!patronfinished)
    {
      Patron patron;
      patron.name();
      patron.libnumber();
      if(isfee()){
                  patron.setfee();}
      cin.ignore();
      runBook(); // Call book function
      patronstore.patrons.push_back(patron);
      cout &lt;&lt; "Is there another patron?(Y or N): ";
        cin &gt;&gt; notfinished;
        if(notfinished == 'Y'){ 
                         cin.ignore();
                         cout &lt;&lt; endl;}
          else if(notfinished == 'N') patronfinished = true;
          else _error("Must be Y or N");
    }
}

// Main-------------------------------------------------------------------------   

int main()
{    
 runPatron();
     keep_window_open();
}
</code></pre>

<p>If you go to class Library and into the Transaction struct, that is where I want to store the date.             </p>
