Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main ()
  4. {
  5. setlocale(0, "Russian");
  6. int N,B;
  7. cout << "Введите B=" << endl;
  8. cin >> B;
  9. int p[10];
  10. cout << "Введите N=" << endl;
  11. cin >> N;
  12. for (int i = 0; i < N; i++) {
  13. cout << "Введите p[" << i << "]" << endl;
  14. cin >> p[i];
  15. }
  16. int a = 0;
  17. cout << "\n";
  18. for (int i = 0; i < N; i++)
  19. if (p[i] < B) // выбрасываем эл-ты > B
  20. p[a++] = p[i];
  21. cout << "Элементы массива,которые меньше числа B:" << "\n";
  22. for (int i = 0; i < a; i++)
  23. cout << "p[" << i << "]=" << p[i] << endl;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement