Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- int main(){
- int v[1000], i, j, aux, jugadores, grupos;
- char nombres[100][100];
- srand(time(NULL));
- cout << " Introduce cuantos jugadores: ";
- cin >> jugadores;
- cout << " En grupos de: ";
- cin >> grupos;
- for( i=0 ; i<jugadores ; i++ )
- v[i]=i;
- for( i=0 ; i<jugadores ; i++ ){
- j=(rand()%jugadores);
- aux=v[j];
- v[j]=v[i];
- v[i]=aux;
- }cout << "\n" ;
- for( i=0 ; i<jugadores ; i++ ){
- cout << " Introduce otro nombre: ";
- cin >> nombres[i];
- }cout << "\n " ;
- for( i=0 ; i<jugadores ; i++ ){
- cout << nombres[v[i]] << "\n ";
- if( (i+1)%grupos==0 ) cout << " --- \n ";
- }cout << "\n " ;
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement