[ create a new paste ] login | about

Link: http://codepad.org/juaU8JHo    [ raw code | output | fork ]

C++, pasted on Jul 29:
#include <iostream>

using namespace std;

int main()
{
    int tab[10] = { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 };

    srand(time(NULL));
     
    int x; 
    int a=0; 
    for(int i=0; i<2; i++)
    {
      for(int j=0; j<5; j++)
      {       
           x=rand()%10;  
       
           
           for(int k=0; k<10; k++) 
           {
              if(tab[k]==x) 
              {
                  x=rand()%10;  
                  k=0; 
              }
           }
           tab[a++]=x; 
           cout<<" "<<x; 
}
      cout<<endl;
              
    } 
   
    return 0; 
   
}


Output:
1
2
 3 1 9 8 0
 2 3 6 7 5


Create a new paste based on this one


Comments: