Created
May 29, 2015 06:21
-
-
Save MasazI/b2a5c3a7e617cbb9a3d9 to your computer and use it in GitHub Desktop.
minmax.cpp(C++11)
This file contains hidden or 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
// | |
// minmax.cpp | |
// CplusplusPractice | |
// | |
// Created by masai on 2015/05/29. | |
// Copyright (c) 2015年 masai. All rights reserved. | |
// | |
#include <iostream> | |
#include <vector> | |
int main(int argc, char* argv[]){ | |
double x = 10.34, y = 3.5, z = 4.3; | |
// コンテナ | |
std::vector<double> v = {x, y, z}; | |
auto minmax = std::minmax_element(v.begin(), v.end()); | |
std::cout << "min: " << *minmax.first << std::endl; | |
std::cout << "max: " << *minmax.second << std::endl; | |
// 初期化子 | |
auto t1 = std::minmax(1,999); | |
std::cout << "min: " << t1.first << std::endl; | |
std::cout << "max: " << t1.second << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment