Advertisement
HyperSensualNarwhal

Untitled

Jan 10th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3.  
  4. using std::cout;
  5. using std::cin;
  6. using std::endl;
  7.  
  8. #define TAB '\t';
  9. #define TRIPLENDL cout << endl << endl << endl;                    
  10.  
  11. void main()
  12. {
  13.     setlocale(LC_ALL, "Ru");
  14.     srand(time(NULL));
  15.  
  16.     const int n = 10;
  17.  
  18.     int Numeria[n] = { };
  19.     // int tms;                                                
  20.    
  21.     int tmp = rand() % 15;                          // генерация случайного числа
  22.  
  23.     TRIPLENDL
  24.  
  25.     for (int i = 0; i < n; ++i)
  26.     {
  27.         // tms = 1;
  28.        
  29.         for (int j = i + 1; j < n; ++j)                            
  30.         {
  31.             if (Numeria[i] == Numeria[j])
  32.             {
  33.                
  34.                 // tms += 1;
  35.             }
  36.  
  37.         }
  38.  
  39.         for (int j = i - 1; j >= 0; --j)                   
  40.             if (Numeria[i] == Numeria[j]) tms = 1;
  41.        
  42.  
  43.         if (tms > 1) continue;
  44.         else cout << (Numeria[i] = tmp) << TAB;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement