Advertisement
HyperSensualNarwhal

10.01

Jan 10th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3.  
  4. using std::cin;
  5. using std::cout;
  6. using std::endl;
  7.  
  8. #define TAB '\t';
  9. #define E4 cout << "\n\n\n\n";
  10. #define E10 cout << "\n\n\n\n\n\n\n\n\n\n";
  11.  
  12. void main()
  13. {
  14.     setlocale(LC_ALL, "Ru");
  15.     srand(time(NULL));
  16.  
  17.     const int size = 10;
  18.  
  19.     int Arona[size];
  20.     int Borea[size];
  21.     int Cyrea[size * 2];
  22.    
  23.     int temp;
  24.  
  25.         cout << "Arona:" << TAB;
  26.  
  27.     for (int i = 0; i < size; ++i)
  28.         cout << (Arona[i] = rand() % 100) << TAB;
  29.  
  30.     E4
  31.    
  32.         cout << "Borea:" << TAB;
  33.  
  34.     for (int i = 0; i < size; ++i)
  35.         cout << (Borea[i] = rand() % 100) << TAB;
  36.  
  37.     E4
  38.  
  39.         cout << "Cyrea:" << TAB;
  40.  
  41.     for (int i = 0; i < size * 2; ++i)
  42.     {
  43.         if (i < size)
  44.         {
  45.             cout << (Cyrea[i] = Arona[i]) << TAB;
  46.         }
  47.         else
  48.         {
  49.             cout << (Cyrea[i] = Borea[i - 10]) << TAB;
  50.         }
  51.     }
  52.  
  53.    
  54.     for (int i = 0; i < size * 2; ++i)
  55.     {
  56.         for (int j = size * 2 - 1; j > i; --j)
  57.         {
  58.             if (Cyrea[j - 1] > Cyrea[j])
  59.             {
  60.                 temp = Cyrea[j - 1];
  61.                 Cyrea[j - 1] = Cyrea[j];
  62.                 Cyrea[j] = temp;
  63.             }
  64.         }
  65.     }
  66.  
  67.     E4
  68.  
  69.     cout << "Sorted: ";
  70.  
  71.     for (int i = 0; i < size * 2; ++i)
  72.         cout << Cyrea[i] << TAB;
  73.  
  74.     E4
  75.  
  76.     // Arona + Borea
  77.     /*
  78.     for (int i = 0; i < size; ++i)
  79.         cout << (Borea[i] = rand() % 100) << TAB
  80.  
  81.     E4
  82.  
  83.     for (int i = 0; i < size; ++i)
  84.     {
  85.         Carea[i] = Arona[i] + Borea[i];
  86.  
  87.     }
  88.  
  89.     for (int i = 0; i < size; ++i)
  90.         cout << Carea[i] << TAB;
  91.  
  92.     E10*/
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement