Advertisement
Guest User

3 array and common element

a guest
Nov 24th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. //////////////////////////////
  2. //// Posted By Ivan Jhahy ///
  3. /////////////////////////////
  4.  
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. int main(){
  9.         srand(time(NULL));
  10.         int dim = rand()%20;
  11.         cout << dim;
  12.         int primo[dim], secondo[dim], terzo[dim], i, ricorrenza;
  13.         cout << primo[dim] << endl;
  14.         cout << secondo[dim] << endl;
  15.         cout << terzo[dim] << endl;
  16.         while (i<dim){
  17.                primo[i] = rand()%100;
  18.                cout << primo[i] << endl;
  19.                secondo[i] = rand()%100;
  20.                cout << secondo[i] << endl;
  21.                terzo[i] = rand()%100;
  22.                cout << terzo[i] << endl;  
  23.                if (primo[i] && secondo[i] && terzo[i])
  24.                   ricorrenza = primo[i];
  25.                   cout << ricorrenza << endl;  
  26.         }
  27.         system("PAUSE");
  28.         return 1;
  29.        
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement