예제 #1
0
double test1() {
	int t0[] = {15, 2, 9, 10};
	vector <int> p0(t0, t0+sizeof(t0)/sizeof(int));
	int p1 = 8;
	int p2 = 20;
	ChangingSounds * obj = new ChangingSounds();
	clock_t start = clock();
	int my_answer = obj->maxFinal(p0, p1, p2);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int p3 = -1;
	cout <<"Desired answer: " <<endl;
	cout <<"\t" << p3 <<endl;
	cout <<"Your answer: " <<endl;
	cout <<"\t" << my_answer <<endl;
	if (p3 != my_answer) {
		cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
		return -1;
	}
	else {
		cout <<"Match :-)" <<endl <<endl;
		return (double)(end-start)/CLOCKS_PER_SEC;
	}
}
예제 #2
0
double test2() {
	int t0[] = {74,39,127,95,63,140,99,96,154,18,137,162,14,88};
	vector <int> p0(t0, t0+sizeof(t0)/sizeof(int));
	int p1 = 40;
	int p2 = 243;
	ChangingSounds * obj = new ChangingSounds();
	clock_t start = clock();
	int my_answer = obj->maxFinal(p0, p1, p2);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int p3 = 238;
	cout <<"Desired answer: " <<endl;
	cout <<"\t" << p3 <<endl;
	cout <<"Your answer: " <<endl;
	cout <<"\t" << my_answer <<endl;
	if (p3 != my_answer) {
		cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
		return -1;
	}
	else {
		cout <<"Match :-)" <<endl <<endl;
		return (double)(end-start)/CLOCKS_PER_SEC;
	}
}
예제 #3
0
int main()
{
	int a[]={5,3,7};
	vector<int> v(a,a+sizeof(a)/sizeof(a[0]));
	int begin=5;
	int end=10;
	ChangingSounds obj;
    cout<<endl<<endl<<obj.maxFinal(v,begin,end)<<endl;
    return 0;
}