Advertisement
Guest User

Untitled

a guest
Oct 16th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. void gravar(string metodo, string op, int ocup, int nop)
  6. {
  7.     ofstream arq("saida.txt", ofstream::app);
  8.     arq<<metodo<<";"<<op<<";"<<ocup<<";"<<nop<<"\n";
  9. }
  10.  
  11. int main()
  12. {
  13.     srand(time(NULL));
  14.     THash tab;
  15.     inicializa(tab);
  16.     for(int i=1 ; i<=2000; i++)
  17.     {
  18.         int chave = rand()%32000+1;
  19.         insere(tab, chave);
  20.         if(i == 90 || i== 240 || i==740 || i == 990 || i==1990 )
  21.         {
  22.             int ocup=(i+10)/10;
  23.  
  24.             for(int j=0 ; j<20; j++)
  25.             {
  26.                 chave = rand()%32000+1;
  27.                 int nop;
  28.                 nop = inserirTEA(tabela, chave);
  29.                 gravar("Endeaberto", "insercao", ocup, nop);
  30.                 chave = rand()%32000+1;
  31.                 nop = pesquisarTHEA(tabela, chave);
  32.                 gravar("Endeaberto", "pesquisa", ocup, nop);
  33.             }
  34.         }
  35.     }
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement