Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int ma1=0;
  6. const int N = 5;
  7. int m[N] = { 2,1,3,4,32 };
  8. for (int i = 0;i < N;i++) {
  9. if (m[i]%2==1) {
  10. ma1++;
  11. }
  12. }
  13. int *m1=new int[ma1];
  14. int *m2 = new int[N-ma1];
  15. for (int i = 0;i < N;i++) {
  16. if (m[i] % 2 == 1) {
  17. m1[i] = m[i];
  18. cout << "[" << m1[i] << "] ";
  19. }
  20. }
  21. cout << endl;
  22. for (int i = N-1;i >= 0;i--) {
  23. if(m[i]%2!=1) {
  24. m2[i] = m[i];
  25. cout << "[" << m2[i] << "] ";
  26. }
  27. }
  28.  
  29. system("pause");
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement