Needsorting

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream.h>
#include <fstream.h>
#include <time.h>
main () {
ofstream fout ("input.txt");
int N,a;
cout<<"This program creates 'input.txt' files with numbers needed to sort\nHow much numbers : ";
cin>>N;
cout<<"Maximum number : ";
cin>>a;
for (int i=N;i>0;i--){
srand (time (NULL));
int r=rand () % a+0;
r=(((r+i)*3)/4);
while(r>a){
r/=10;
}
fout<<r<<" ";}
fout.close();
return 0;
}