Advertisement
Metaraddin

Untitled

Apr 14th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. void vtor(std::vector <int> poslos)
  2. {
  3. int res1 = 0;
  4. int res2 = poslos.at(0);
  5. for (int i = 0; i < poslos.size(); i++)
  6. {
  7. if (poslos.at(i) == perv(poslos.at(i)))
  8. {
  9. res1++;
  10. if (poslos.at(i) < res2)
  11. {
  12. res2 = poslos.at(i);
  13. }
  14. }
  15. }
  16. std::cout << "\n (2 зад.) Количество подходящих чисел: " << res1 << "\n (2 зад.) Наименьшее среди этих чисел: " << res2 << "\n";
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement