I have this error does anyone know how to fix

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

class Person
{
private:
string name;
int age;

public:

string getName()
{
return name;
}

int getAge()
{
return age;
}

void setName(string myName)
{
name=myName;
}

void setAge(int myAge)
{
age=myAge;
}

Person(string myName, int myAge)
{
setName( myName);
setAge(myAge);
}
};

int main(int Person[])
{

Person people[100];
int count=0;
string name="";
int age =0;
cout<<"Enter name (-1 to stop): ";
cin >>name;
people[count].setName(name);
cout<<"Enter age of "<< name <<" :";
cin >> age;
people[count].setAge(age);
while(people.getName()=="-1")
{
count=count+1;
cout<<"Enter name (-1 to stop): ";
cin >>name;
people[count].setName(name);
cout<<"Enter age of "<< name <<" :";
cin >> age;
people[count].setAge(age);
}
for(int i=0; i<count; i++)
{
cout <<" Name: " << people[i].getName()<< ", age: "<< people[i].getAge()<< endl;
}

int min = people[0].getAge();
string minName = people[0].getName();
for(int i=0; i<count; i++)
{
for(int j=1; j<count; j++)
{
if (people[i].getAge() > people[j].getAge())
{
min = people[j].getAge();
people[j].setAge(people[i].getAge());
people[i].setAge(min);
minName = people[j].getName();
people[j].setName(people[i].getName());
people[i].setName(minName);
}
}

};
system("PAUSE");
return 0;
}
C:\Users\tsrainey\Desktop\123.cpp In function `int main(int*)':

46 C:\Users\tsrainey\Desktop\123.cpp expected `;' before "people"

52 C:\Users\tsrainey\Desktop\123.cpp `people' undeclared (first use this function)

(Each undeclared identifier is reported only once for each function it appears in.)
Please this is very urgent
nt main(int Person[])i This is not a valid signature for main. Change it to:
int main() and see if some of the other errors go away.

You need to define a default constructor. Add in the public section of the class:
Person() : age(0) {}

Also, if you are going to call getName() in the condition of the while loop you would need :
while(people[count].getName()!="-1")

and not

while(people.getName()!="-1").

There are a few other subtle problems.
Inside the while loop on the line cin >>name; if the user enters "-1" your code still continues and stores the name "-1" and prompts for the age of the person named "-1".
What happens if the user enters more than 100 persons?
Topic archived. No new replies allowed.