ダディクールがC/C++の宿題を片づけます 32代目
■ このスレッドは過去ログ倉庫に格納されています
0882デフォルトの名無しさん
NGNGtemplate <class T, unsigned N>
inline int
count( const T (&t)[ N ] )
{
double avg = std::accumulate( &t[ 0 ], &t[ N ], 0.0 ) / N;
return std::count_if( &t[ 0 ], &t[ N ], std::bind2nd( std::greater_equal<double>(), avg ) );
}
int main(){
int n[] = { 0, 10, 20, 30, 40, 50, 60, 70 };
std::cout << count( n ) << std::endl;
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています