예제 #1
0
Dlist percents(const Dlist& L, double n) {
	Dlist Dl;
	for (int i=0; i<L.size(); i++) {
		Dl.push_back(percent(L[i],n));
	}
	return Dl;
}
예제 #2
0
int main()
{
	Dlist<int> dlist;
	int i=dlist.size();
	std::cout<<i<<std::endl;
	
	dlist.push_back(2);
	for (int j1=0; j1<dlist.size(); ++j1)
		std::cout<<dlist.value(j1+1)<<'-';
	std::cout<<std::endl;
	dlist.push_front(4);
	for (int j2=0; j2<dlist.size(); ++j2)
		std::cout<<dlist.value(j2+1)<<'-';
	std::cout<<std::endl;
	dlist.insert_after(7,1);
	i=dlist.size();
	std::cout<<i<<std::endl;
	for (int j3=0; j3<dlist.size(); ++j3)
		std::cout<<dlist.value(j3+1)<<'-';
	std::cout<<std::endl;

	dlist.reverse();
	std::cout<<dlist.size()<<std::endl;
	for (int j4=0; j4<dlist.size(); ++j4)
		std::cout<<dlist.value(j4+1)<<'-';
	std::cout<<std::endl;
	dlist.clear();
	std::cout<<dlist.size()<<std::endl;
	return 0;
}
예제 #3
0
Dtable ddivide_floor(const Table& T, double d) {
	Dtable t;
	for (int i=0; i<T.size(); i++) {
		Dlist l;
		for (int j=0; j<T[i].size(); j++) {
			l.push_back(floor(T[i][j]/d));
		}
		t.push_back(l);
	}
	return t;
}
예제 #4
0
Dtable mult(const Dtable& T, double d) {
	Dtable t;
	for (int i=0; i<T.size(); i++) {
		Dlist l;
		for (int j=0; j<T[i].size(); j++) {
			l.push_back(T[i][j]*d);
		}
		t.push_back(l);
	}
	return t;
}
예제 #5
0
Dlist var(const List& L) {
	Dlist v;
	for (int i=0; i<L.size(); i++) v.push_back(L[i]+fRand(0,0.2));
	return v;
}
예제 #6
0
Dlist division(const Dlist& L, double d) {
	Dlist Dl;
	for (int i=0; i<L.size(); i++) Dl.push_back(L[i]/d);
	return Dl;
}