Home > Back-end >  Class c array, understand the problem, ask for help
Class c array, understand the problem, ask for help

Time:10-31

I am a rookie, help bosses
#include
#include
using namespace std;
The class Employee {
Private:
Char name [30]. Char street [30]. Char city [20]. Char zip [8];
Public:
The Employee (char * n, char * STR, char * ct, char * z);
Void change_name (char * n);
Void the display (); To the Employee ();
};
Employee: : ~ the Employee () {} the Employee: : the Employee (char * n, char * STR, char * ct, char * z) {strcpy (name, n); Strcpy (street, STR); Strcpy (city, ct); Strcpy (zip, z); }
Void the Employee: : change_name (char * n) {strcpy (name, n); }
Void the Employee: : display () {cout & lt; Int main ()
{
[1] char a, b [1], c [1], [1], d e [1];
A [0]='1'.
B [0]='1';
C [0]='1';
D [0]='1';
E [0]='1';
int i;
The Employee p [5]={Employee (a, a, a, a), the Employee (b, b, b, b), the Employee (c, c, c, c), Employee (d, d, d, d), the Employee (e, e, e, e)}; for(i=0; i<5; I++)
{p [I]. The display (); CoutSo why not output line are the same?
  • Related