#include <iostream>
#include <vector>
#include <algorithm>
#include "person.h"

int main(){
	std::vector<int> v2;
	v2.push_back(3);
	v2.push_back(2);
	v2.push_back(5);
	v2.push_back(1);
	std::cout << "before" << std::endl;
	for(int i=0; i<v2.size(); ++i){
		std::cout << v2[i] << std::endl;
	}
	std::sort(v2.begin(), v2.end());
	std::cout << "after" << std::endl;
	for(int i=0; i<v2.size(); ++i){
		std::cout << v2[i] << std::endl;
	}
	// make a Person class object
	Person alice; // call the default constructor
        Person david("David", 48, "Male"); // call the other constructor
        Person jake("Jake", 38, "Male"); // call the other constructor
        Person lisa("Lisa", 13, "Female"); // call the other constructor

	alice.setName("Alice");
	alice.setAge(21);
	alice.setGender("Female");
	Person alice2("Alice", 21, "Female");
	// make a copy of alice as alice3.
	// call the copy construtor.
	Person alice3(alice);
	std::vector<Person> v;
	v.push_back(alice);
	v.push_back(david);
	v.push_back(jake);
	v.push_back(lisa);
	int size = v.size();
	std::cout << "before sorting:" << std::endl;
	for(int i=0; i<size; ++i){
		std::cout << v[i].getName() << " " << v[i].getAge() << std::endl;
	}
	// std::sort(v.begin(), v.end(), compareByAge);
	std::sort(v.begin(), v.end());
	std::cout << "after sorting:" << std::endl;
	for(int i=0; i<size; ++i){
		std::cout << v[i].getName() << " " << v[i].getAge() << std::endl;
	}
	/*std::cout << alice.getName() << std::endl;
	std::cout << alice.getAge() << std::endl;
	if(compareByAge(alice, david) == true){
		std::cout << "Alice is younger" << std::endl;
	}else{
		std::cout << "David is younger"<< std::endl;
	}*/

	if(alice == alice3){
		std::cout << "these two are the same person" << std::endl;
	}else{
		std::cout << "these two are not the same person" << std::endl;
	}
	return 0;
}
