Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<time.h>
- #include<stdio.h>
- int main()
- {
- FILE* f;
- int n, i;
- srand(time(NULL));// Pszeudo-véletlen számsorozat generálása
- f = fopen("szamok.bin","wb");
- n = rand()%21 + 15; // [15,35] intervallumra generál
- printf("n = %d\n", n);
- for(i=0 ; i < n ; ++i)
- {
- int tmp;
- tmp = rand()%201 - 100;// [-100,100] intervallumra generál
- fwrite(&tmp, sizeof(int), 1, f);
- printf("%d ", tmp);
- }
- fclose(f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement