Pages

Scope resolution operator in C++

Monday 13 May 2013

#include <iostream>
using namespace::std;
class date
{
      int day;
      int month;
      int year;
      public:
             int setdate(int, int, int);
             void display()
             {
                  cout<<day<<"/"<<month<<"/"<<year<<endl;
             }
};
int date::setdate(int d, int m, int y)
{
    day=d;
    month=m;
    year=y;
}
int main()
{
    int d, m, y;
    date a1;
    cout<<"Enter Day: "; cin>>d;
    cout<<"Enter Month: "; cin>>m;
    cout<<"Enter Year: "; cin>>y;
    a1.setdate(d, m, y);
    a1.display();
    system("pause");
}
 

Search Box

Most Reading

Contact Form

Name

Email *

Message *