Losowanie liczb do pliku
Dane wyjściowe:
72 50 74 33 49 11 48 54 79 39 35 93 56 11 84 22 34 71 68 52 5 68
94 77 78 86 91 71 21 71 29 89 78 13 38 57 64 32 73 41 26 66 86 25
6 86 90 61 99 71 48 79 45 91 18 23 48 …….
……. 44 24 16 85 69 31 29 91 90 18 28 78 80
65 93 89 25 9 67 6 100 53 74 37 47 98 80 21 55 11 97 32 48 25 8
22 56 80 79 20 4 10 26 41 82 80 35 64 65 49 34 51 70 65 97 23 67
Kompilator: Dev C++
//Losowanie liczb do pliku
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
int x;
fstream o;
srand(time(NULL));
o.open("los.txt", ios::out);
if (o.is_open())
{
for(int i=0;i<=1000;i++)
{
x=rand()%100+1;
o<<x<<"\t";
}
}
system("PAUSE");
return EXIT_SUCCESS;
}