Example #1
0
int main () {

    vector<string> people;
    people.push_back("9 2 3");
    people.push_back("4 8 7");

    TallPeople usedClass;

    vector<int> answer = usedClass.getPeople(people);

    cout << answer[0] << " " << answer[1] << endl;


    return 0;
}
Example #2
0
double test1() {
	string t0[] = {"1 2",
 "4 5",
 "3 6"};
	vector <string> p0(t0, t0+sizeof(t0)/sizeof(string));
	TallPeople * obj = new TallPeople();
	clock_t start = clock();
	vector <int> my_answer = obj->getPeople(p0);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int t1[] = { 4,  4 };
	vector <int> p1(t1, t1+sizeof(t1)/sizeof(int));
	cout <<"Desired answer: " <<endl;
	cout <<"\t{ ";
	if (p1.size() > 0) {
		cout <<p1[0];
		for (int i=1; i<p1.size(); i++)
			cout <<", " <<p1[i];
		cout <<" }" <<endl;
	}
	else
		cout <<"}" <<endl;
	cout <<endl <<"Your answer: " <<endl;
	cout <<"\t{ ";
	if (my_answer.size() > 0) {
		cout <<my_answer[0];
		for (int i=1; i<my_answer.size(); i++)
			cout <<", " <<my_answer[i];
		cout <<" }" <<endl;
	}
	else
		cout <<"}" <<endl;
	if (my_answer != p1) {
		cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
		return -1;
	}
	else {
		cout <<"Match :-)" <<endl <<endl;
		return (double)(end-start)/CLOCKS_PER_SEC;
	}
}