Please correct the errors with replacement lines beside it


Please correct the errors with replacement lines beside it. And then give short notes on why it is wrong.

The code is attached.

1) Please correct the errors with replacement lines beside it. And then give short notes on why it is wrong.

class Person
{
private:
char name[30];
int age;

public:
Person (string, int);
int setage (int);
int setname (char *);
void show (void);

};

void main()
{
Person a_group [5];
int i;

for (i=0; i<6; i++)
a_group[i].setage(i+1);

for (i=0;i<6;i++)
cout << "Person " << i+1 << " is " << a_group[i].age << end1;
}

2) Please correct the errors with replacement lines beside it. And then give short notes on why it is wrong if the below codes replace the codes between the two === in 1):

void main (void)
{
Person a_person;
a_person.age = 99;
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Please correct the errors with replacement lines beside it
Reference No:- TGS01247924

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)