hobab1987
یک شنبه 13 اردیبهشت 1388, 00:07 صبح
سلام
اشكال سازنده هاي اين برنامه نمي دونم چيه!!!
PLZ HELP
#include <iostream.h>
#include <conio.h>
#include <process.h>
#define n 10
#define col 30
class employee
{
public:
void get();
void show();
void employee(char *f,char *l,int d);
void ~employee();
private:
char firstname[20];
char lastname[20];
int id;
class date
{
public:
void get();
void show();
void date(int y,int m,int da);
void ~date();
private:
int year;
int month;
int day;
class address
{
public:
void get();
void show();
void address(char *t,char *s1,char *s2,char *a,int p);
void ~address();
private:
char town[20];
char state[20];
char street[20];
char alley[20];
int plaque;
};
address adrs[n];
};
date dte[n];
};
employee em[n];
//*************************************
void main()
{
int i;
for(i=0;i<n;i++)
{
em[i].get();
em[i].show();
dte[i].get();
dte[i].show();
adrs[i].get();
adrs[i].show();
}
}
//*************************************
employee::employee(char *f,char *l,int d)
{
f=firstname;
l=lastname;
d=id;
}
void employee::get()
{
clrscr();
gotoxy(25,12);
cout<<"________Get Personal Identity________"<<endl;
gotoxy(col,15);
cout<<"First name:";
cin>>firstname;
f=firstname;
gotoxy(col,17);
cout<<"Last name:";
cin>>lastname;
l=lastname;
gotoxy(col,19);
cout<<"ID:";
cin>>id;
d=id;
}
void employee::show()
{
clrscr();
gotoxy(25,12);
cout<<"________View Personal Identity________"<<endl;
gotoxy(col,15);
cout<<"First name:"<<firstname;
gotoxy(col,17);
cout<<"Last name:"<<lastname;
gotoxy(col,19);
cout<<"ID:"<<id;
getch();
}
//***********************************************
date::date(int y,int m,int da)
{
y=day;
m=month;
da=year;
}
void date::get()
{
clrscr();
gotoxy(25,12);
cout<<"Enter date of born please:(DD/MM/YY)";
cin>>day>>month>>year;
}
void date::show()
{
clrscr();
gotoxy(25,12);
cout<<"________Date of born________";
gotoxy(col,15);
cout<<day<<"/"<<month<<"/"<<year;
getch();
}
//********************************************
address::address(char *t,char *s1,char *s2,char *a,int p)
{
t=town;
s1=state;
s2=streat;
a=alley;
p=plaque;
}
void address::get()
{
clrscr();
cout<<"________Get Address_________"<<endl;
cout<<"Town:";
cin>>town;
cout<<"State:";
cin>>state;
cout<<"Street:";
cin>>streat;
cout<<"Alley";
cin>>alley;
cout<<"Plaque-num";
cin>>plaque;
}
void address::show()
{
clrscr();
gotoxy(25,12);
cout<<"________Show Address_________"<<endl;
gotoxy(col,15);
cout<<"Town:"<<town;
gotoxy(col,15);
cout<<"State:"<<state;
gotoxy(col,15);
cout<<"Street:"<<streat;
gotoxy(col,15);
cout<<"Alley"<<alley;
gotoxy(col,15);
cout<<"Plaque-num"<<plaque;
getch();
}
employee::~employee()
{
{
cout<<"Finished!";
}
}
date::~date()
{
{
cout<<"Finished!";
}
}
address::~address()
{
{
cout<<"Finished!";
}
}
اشكال سازنده هاي اين برنامه نمي دونم چيه!!!
PLZ HELP
#include <iostream.h>
#include <conio.h>
#include <process.h>
#define n 10
#define col 30
class employee
{
public:
void get();
void show();
void employee(char *f,char *l,int d);
void ~employee();
private:
char firstname[20];
char lastname[20];
int id;
class date
{
public:
void get();
void show();
void date(int y,int m,int da);
void ~date();
private:
int year;
int month;
int day;
class address
{
public:
void get();
void show();
void address(char *t,char *s1,char *s2,char *a,int p);
void ~address();
private:
char town[20];
char state[20];
char street[20];
char alley[20];
int plaque;
};
address adrs[n];
};
date dte[n];
};
employee em[n];
//*************************************
void main()
{
int i;
for(i=0;i<n;i++)
{
em[i].get();
em[i].show();
dte[i].get();
dte[i].show();
adrs[i].get();
adrs[i].show();
}
}
//*************************************
employee::employee(char *f,char *l,int d)
{
f=firstname;
l=lastname;
d=id;
}
void employee::get()
{
clrscr();
gotoxy(25,12);
cout<<"________Get Personal Identity________"<<endl;
gotoxy(col,15);
cout<<"First name:";
cin>>firstname;
f=firstname;
gotoxy(col,17);
cout<<"Last name:";
cin>>lastname;
l=lastname;
gotoxy(col,19);
cout<<"ID:";
cin>>id;
d=id;
}
void employee::show()
{
clrscr();
gotoxy(25,12);
cout<<"________View Personal Identity________"<<endl;
gotoxy(col,15);
cout<<"First name:"<<firstname;
gotoxy(col,17);
cout<<"Last name:"<<lastname;
gotoxy(col,19);
cout<<"ID:"<<id;
getch();
}
//***********************************************
date::date(int y,int m,int da)
{
y=day;
m=month;
da=year;
}
void date::get()
{
clrscr();
gotoxy(25,12);
cout<<"Enter date of born please:(DD/MM/YY)";
cin>>day>>month>>year;
}
void date::show()
{
clrscr();
gotoxy(25,12);
cout<<"________Date of born________";
gotoxy(col,15);
cout<<day<<"/"<<month<<"/"<<year;
getch();
}
//********************************************
address::address(char *t,char *s1,char *s2,char *a,int p)
{
t=town;
s1=state;
s2=streat;
a=alley;
p=plaque;
}
void address::get()
{
clrscr();
cout<<"________Get Address_________"<<endl;
cout<<"Town:";
cin>>town;
cout<<"State:";
cin>>state;
cout<<"Street:";
cin>>streat;
cout<<"Alley";
cin>>alley;
cout<<"Plaque-num";
cin>>plaque;
}
void address::show()
{
clrscr();
gotoxy(25,12);
cout<<"________Show Address_________"<<endl;
gotoxy(col,15);
cout<<"Town:"<<town;
gotoxy(col,15);
cout<<"State:"<<state;
gotoxy(col,15);
cout<<"Street:"<<streat;
gotoxy(col,15);
cout<<"Alley"<<alley;
gotoxy(col,15);
cout<<"Plaque-num"<<plaque;
getch();
}
employee::~employee()
{
{
cout<<"Finished!";
}
}
date::~date()
{
{
cout<<"Finished!";
}
}
address::~address()
{
{
cout<<"Finished!";
}
}