Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 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 = new int [N];
  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. a++;
  22. }
  23. cout << "Элементы массива,которые меньше числа B:" << "\n";
  24. for (int i = 0; i < a; i++)
  25. cout << "p[" << i << "]=" << p[i] << endl;
  26. cout << "N=" << N << endl;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement