For Better Performance Please Use Chrome or Firefox Web Browser

32-3

#include<iostream.h>

class Taarikh {
public:
	Taarikh();	// defalult constructor
	~Taarikh(); // destructor
	void setDate (int r, int m, int s);
	void getDate (int *r, int *m, int *s);
	void boroJelo();	// rooz, maah, saal raa yek rooz
						// be jelo mibarad
private:
	int rooz, maah, saal;
};

Taarikh::Taarikh()
{
	rooz = maah = saal = 1;
}


Taarikh::~Taarikh()
{
}

void Taarikh::setDate (int r, int m, int s)
{
	// check sehhate ettelaa'aate voroodi
	// ...
	rooz = r;
	maah = m;
	saal = s;
}

void Taarikh::getDate (int *r, int *m, int *s)
{
	*r = rooz;
	*m = maah;
	*s = saal;
}

void Taarikh::boroJelo()
{
	rooz++;
}

void main ()
{
	int r, m, s;
	Taarikh tarikhTavallod;
	
	cout << "Taarikhe tavallod raa vaared konid:\n";
	cout << "rooz: ";
	cin >> r;
	cout << "maah: ";
	cin >> m;
	cout << "saal: ";
	cin >> s;

	tarikhTavallod.setDate(r, m, s);
	tarikhTavallod.boroJelo();
	tarikhTavallod.getDate(&r, &m, &s);
}

تحت نظارت وف ایرانی