Last active
October 21, 2017 09:20
-
-
Save dc1394/0dc61a44a7bf15f5e9289311a499895a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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