Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include "iostream"
  2. #include "windows.h"
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. cout<<"Vvedite kolichestvo chisel v massive: ";
  9. int n;
  10. cin >> n;
  11. int *A = new int [n];
  12. int *B = new int [n];
  13. int k, l;
  14. k=0;
  15. l=0;
  16. cout<<"\n"<<" Vvedite pervii massiv: ";
  17. for (int i = 0; i < n; i++)
  18.     {
  19.     cin >> A[i];
  20.     if (A[i] < 0)
  21.     k++;
  22.     }
  23. cout<<"\n"<<" Vvedite vtoroi massiv: ";
  24. for (int i = 0; i < n; i++)
  25.     {
  26.     cin >> B[i];
  27.     if (B[i] < 0)
  28.     l++;
  29.     }
  30. if ((l = k) && (l != 0))
  31. {
  32.     cout << "Kolichestvo otricatelnih chisel ravno";
  33.     system("pause");
  34.     return 0;
  35.     }
  36.            
  37. if ((k=0) && (l = 0))
  38. {
  39.     cout << "Otricatelnii chisla otsutstvuyt";
  40.     system("pause");
  41.     return 0;
  42. }
  43. if(l > k)  
  44. {
  45.    for (int i = 0; i < n; i++)
  46.     {
  47.       cout << B[i]<< " ";
  48.     }
  49.    cout << "\n";
  50.    for (int i = 0; i < n; i++)
  51.     {
  52.     cout << A[i] << " ";
  53.     }
  54.     system("pause");
  55.     return 0;
  56. }
  57. else {
  58.     for (int i = 0; i < n; i++)
  59.         cout << A[i];
  60.         cout << "\n";
  61.     for (int i = 0; i < n; i++)
  62.         cout << B[i] << " ";
  63.     system("pause");
  64.     return 0;
  65. }
  66. if ((l = k) && (l != 0)) cout << "Kolichestvo otricatelnih chisel ravno";
  67. if ((l = k) && (l = 0)) cout << "Otricatelnii chisla otsutstvuyt";
  68. system("pause");
  69. return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement