Advertisement
Mastercpp

VECTORES NUMEROS VALORES ALEATORIOS

Oct 28th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <cmath>
  4. #include <ctime>
  5. using namespace std;
  6.  
  7. int main(){
  8.  
  9.     srand(time(NULL));
  10.  
  11.     int aleatorio = rand()%5000+1;
  12.     int vector[10];
  13.  
  14.     for(int i =0; i<10; i++){
  15.         vector[i] = aleatorio;
  16.         aleatorio = rand()%5000+1;
  17.     }
  18.  
  19.     for(int i =0; i<10; i++){
  20.         cout << vector[i] << " ";
  21.     }
  22.  
  23.    
  24.  
  25.     cin.get();
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement