shushus

Спринт 1. Алгоритмы count и count_if. Задание 1

Dec 3rd, 2022
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. void PrintWorryCount(const vector<bool>& is_nervous) {
  8.     // подсчитываем количество элементов в векторе is_nervous, равных true
  9.     cout << count(is_nervous.begin(), is_nervous.end(), true) << endl;
  10. }
  11.  
  12. int main() {
  13.     // не меняйте содержимое функции main
  14.     PrintWorryCount({true, true, false, true});
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment