#include <iostream>
#include <string>
using namespace std;
int i; // variable for book titles
string arrayDB[10];// declare an array of 20
string arrayDB2[10]; // array for date
//void printbook();
class book
{
public:
string bktitle;
int date;
int data (int, int, int); //int DD, MM, YY;
bool checkdate(int m, int d, int y);
};
class date
{
int DD,MM,YY;
public:
void setDate (int, int, int);
/************************************************************************check date vedidation *****************************************************************/
bool check_date(const string& strN, int iMaxYea = 2012)
{
bool bdate = true;
if( strN.length() != 8)
bdate = false;
int iDay = atoi(strN.substr(0, 2).c_str()); // Declare the int variable iDay , exceutes the substr for character offset of the day is 0 and 2 character long, using aoti(arrary to interger).
if (iDay > 31 || iDay < 1) // If Day is greater than 31 and less than 1
bdate = false; // boolean is false
if (!bdate)
{ //If boolean statement is not true
cout << "Error! Dateformat must be: ddmmyyyy!" << endl;
}
return bdate; // return the boolean
/**********************************************************************check date vedidation *****************************************************************/
};
/*
//void setDate()
{
cout<< "Enter the published day :"<< endl;
cin>> DD ;
cout<< "Enter the published month :"<< endl;
cin>> MM ;
cout<< "Enter the published year :"<< endl;
cin>> YY ;
}
*/
void printbook ()
{
for (int list=0; list< 10; list ++)
{
cout<<"Title of Book : " << arrayDB[list]<< " ---------------- Published Date : "<< arrayDB2[list] << endl;
}
}
int main()
{
string bktitle;
int date;
//printbook();
string arrayDB[10];
int arrayDB2[10];
for (int i=0; i<=5; i++)
{
cout<< "Enter the Book Title :"<< endl;
cin>> bktitle;
arrayDB[i] = bktitle;
cout<< "Enter published date :"<< endl;
cin>> date;
}
for (int list=0; list< 6; list ++)
{
cout<<"Title of Book : " << arrayDB[list]<<" ---------------------- " << "Published Date : "<< arrayDB2[list] << endl;
}
}
/************************************************************************check date vedidation *****************************************************************/
bool check_date(const string& strN, int iMaxYea = 2012)
{
bool bdate = true;
if( strN.length() != 8)
bdate = false;
int iDay = atoi(strN.substr(0, 2).c_str()); // Declare the int variable iDay , exceutes the substr for character offset of the day is 0 and 2 character long, using aoti(arrary to interger).
if (iDay > 31 || iDay < 1) // If Day is greater than 31 and less than 1
bdate = false; // boolean is false
if (!bdate)
{ //If boolean statement is not true
cout << "Error! Dateformat must be: ddmmyyyy!" << endl;
}
return bdate; // return the boolean
/**********************************************************************check date vedidation *****************************************************************/
/************************************************************************check date vedidation *****************************************************************/
bool check_date(const string& strN, int iMaxYea = 2012)
{
bool bdate = true;
if( strN.length() != 8)
bdate = false;
int iDay = atoi(strN.substr(0, 2).c_str()); // Declare the int variable iDay , exceutes the substr for character offset of the day is 0 and 2 character long, using aoti(arrary to interger).
if (iDay > 31 || iDay < 1) // If Day is greater than 31 and less than 1
bdate = false; // boolean is false
if (!bdate)
{ //If boolean statement is not true
cout << "Error! Dateformat must be: ddmmyyyy!" << endl;
}
return bdate; // return the boolean
/**********************************************************************check date vedidation *****************************************************************/