Skip to content

Instantly share code, notes, and snippets.

@dc1394
Last active October 21, 2017 09:20
Show Gist options
  • Save dc1394/0dc61a44a7bf15f5e9289311a499895a to your computer and use it in GitHub Desktop.
Save dc1394/0dc61a44a7bf15f5e9289311a499895a to your computer and use it in GitHub Desktop.
#include <iostream> // for std::cout, std::endl
#include <iterator> // for std::distance
#include <boost/range/algorithm/max_element.hpp> // for boost::max_element
int main()
{
auto const height = { 165.5, 155.0, 170.0, 168.0, 50.0, 200.0, 250.0, 2.0, 20.0 };
auto const itr = boost::max_element(height);
std::cout << "身長の最大値は" << *itr << "cmで、生徒の番号は" << std::distance(height.begin(), itr) + 1 << "です。" << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment