Guest User

Untitled

a guest
Jan 21st, 2013
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <time.h>
  6. #include <algorithm>
  7.  
  8. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  9.  
  10. using namespace std;
  11.  
  12. int main(int argc, char *argv[]) {
  13.    
  14.     int x=0, i, b;
  15.     string g[100];
  16.     string t;
  17.  
  18.    
  19.     cout<<"Ponha ai nomes do que quiser e este programa fara uma lista aleatoria"
  20.     <<", isto pode ser util se estiver indeciso/a sobre o que fazer e pode introduzir ate 100 elementos."
  21.     <<"Quando quiser parar basta escrever 'DONE' ";
  22.  
  23.    
  24.     for(i=0; i<100; i++)
  25.     {
  26.    
  27.     cout<<"\nIntroduza o nome de um jogo "<<i+1<<": ";
  28.     cin>>t;
  29.     if(t == "DONE")
  30.     break;
  31.     g[i]=t;
  32.     x=i;
  33.  
  34.     }
  35.    
  36.     srand ( time (NULL));
  37.  
  38.     for(int j=0; j<3; j++)
  39.     {
  40.         int lol = rand() % x;
  41.         cout<<"\n Jogo "<<j+1<<" : "<<g[lol]<<"\n";
  42.     }
  43.  
  44.  
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment