Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<stdio.h>
- #include<conio.h>
- #include<fstream>
- #include<time.h>
- #include<cstdlib>
- #include<algorithm>
- #define N 20000
- using namespace std;
- static unsigned long int next = 1;
- int rand(void)
- {
- next = next * 1103515245 + 12345;
- return (unsigned int)(next/65536) % N;
- }
- void srand(unsigned int seed)
- {
- next = seed;
- }
- int main()
- {
- int tab[N], dane[N], i, k;
- for(i=0; i<N; i++) tab[i] = 0;
- srand(time(NULL));
- for(i=0; i<N; i++){
- do{
- k = rand();
- }while(tab[k] != 0);
- tab[k]++;
- dane[i] = k;
- }
- fstream plik;
- for(int j=1; j<16; j++){
- plik.open("300000.txt", ios::out | ios::app);
- if(plik.good() == true){
- for(i=0; i<N; i++) plik << "Janusz\t" << "Weiss\t" << dane[i] + j*100000 << endl;
- plik.close();
- }
- }
- //for(i=0; i<N; i++) printf("%d\n", dane[i]);
- sort(dane, dane+N);
- //for(i=0; i<N; i++) printf("%d\t", dane[i]);
- printf("Koniec");
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement