I am writing a program for date class, but facing an error in definition of constructor. I am pasting my code below:
Note: i am using compiler devC++ 4.9.2.2 and not need to add 'using namespace ' in this compiler. If you a using other compiler then you have to add 'using name space'.

#include<iostream.h>
#include<stdlib.h>
// defining the date class
class date {
      private:
              int day, month , year;
       public:
              void display();
              void setday(int i);
              void setmonth(int i);
              void setyear(int i);
              int getday();
              int getmonth();
              int getyear();
              // constructors of the class
              date();
              date(int, int);
              date(int,int,int);
              // desttructor of class
              ~date();
              };
             // defining the constructor
             date::date()
             {
                   day=1;
                   month=1;
                   year=1990;
            cout<<"default constructor is called"; 
             }                         
         // constructor with two arguments
         date::date(int , int )
         {
                 day=  12;
                 month =  7;

           cout<<"The constructor with two arguments is called";
           }
         // constructor with three arguments
         date::date(int , int , int )
         {
                 day= 5;
                 month= 7;
                 year= 2013;
         cout<<"the constructor with two arguments is called";
         }                
        // defining member functions of class
         date::  int setday(int day)
          {
             day=day;
          }
        date::  int  setmonth(int month)
        {
            month=month;
        }
         date::  int  setyear(int year)
        {
            year=year;
        }              

main()
{
 date date1, date2;
 date1.setday(12);
 date1.setmonth(5);
 date1.setyear(2014);
 date1.display();

system("pause");      
}

Well your program has a lot of errors:
1. When defining member functions, return type comes before the class name, so
date:: int setday(int day) should be int date::setday(int day).
You have done this mistake everywhere, so correct that. Also these functions are declared void in class and int in definition.
You have not defines some of the functions as well.
Did you even compile the program before posting??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.