CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2008
    Posts
    23

    Plz Dedect Errors

    I am beginners in C++. i have made the following code but it is giving a few errors i am unable to remove them plz indicate it and rectify it.

    #include<iostream>
    using namespace std;
    class Date
    {
    private:
    int day;
    int month;
    int years;

    public:
    void setDay(int i);
    void setMonth(int i);
    void setYears(int i);
    int getDay();
    int getMonth();
    int getYears();
    void display();
    Date();
    Date(int,int);
    Date(int,int ,int);
    ~Date();
    };
    Date:ate()
    { day =1;
    month = 2;
    years =2001;
    cout<<"The default constructor called"<<endl; }

    Date:ate(int d,int m)
    {
    day = d;
    month = m;
    years = 2000;
    cout<<"The two parametrized constroctor called"; }

    Date:ate(int theDay, int theMonth , int theYears=2002)
    { day = theDay;
    month = theMonth;
    years = theYears;
    cout<<"The three parametrized constructor called"<<endl;}
    Date::~Date( )
    {cout<<"I am distroctor"<<endl;}

    void Date::setDay(int i)
    {i = day; }
    void Date::setMonth(int i)
    { i = month;}
    void Date::setYears(int i )
    { i = years; }

    int Date::getDay()
    { return day; }
    int Date::getMonth()
    { return month; }
    int Date::getYears()
    { return years; }
    void Date:isplay()
    { cout<<"The date is:"<<day<<"-"<<month<<"-"<<years<<endl; }

    int main() {

    Date dist1,dist2(4,12),dist3(23,3,2009);
    dist1.display();
    dist2.display();
    dist3.display();
    }

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Plz Dedect Errors

    Not going to help until 3 things happen....

    1) You wrap that up in code tags to preserve indenting,
    2) You tell us what the errors are, and
    3) You give some indication of *where* the errors are since we don't want to have to count line numbers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured