int max_num = *std::max_element(vec.begin(), vec.end());
int min_num = *std::min_element(vec.begin(), vec.end());
auto max_num_index =
(std::find(vec.begin(), vec.end(), max_num) - vec.begin());
auto min_num_index =
(std::find(vec.begin(), vec.end(), min_num) - vec.begin());
'C++ > ํจ์ (Function)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[C++] c type string์ ๋ํ getline ํจ์์ ํ์ฉ (0) | 2024.01.16 |
---|---|
[C++] sort ํจ์ | ๋ฐฐ์ด/๋ฒกํฐ ์ค๋ฆ์ฐจ์ ์ ๋ ฌ (0) | 2024.01.09 |
[C++] transform (0) | 2024.01.05 |
[C++] c_str() ํจ์ (0) | 2023.12.23 |
[C++] ํจ์์์ ํฌ์ธํฐ๋ฅผ ๋ฐํํ๊ธฐ (Returning a Pointer from a Function) (1) | 2023.12.22 |