Advertisement
Mastercpp

numeros aleatorios de vectores

Sep 17th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main(){
  6.    
  7.     int vector[10];
  8.     int aleatorio = rand()%10+1;
  9.    
  10.    
  11.     for(int i =0; i<10; i++){
  12.         vector[i] = aleatorio;
  13.         aleatorio = rand()%10+1;   
  14.     }
  15.  
  16.     cout << "Valores de los vectores \n\n" ;
  17.     for(int i =0; i<10; i++ ){
  18.         cout << vector[i] << endl;
  19.     }
  20.    
  21.    
  22.     cin.get();
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement