-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathggen.cpp
More file actions
32 lines (30 loc) · 738 Bytes
/
ggen.cpp
File metadata and controls
32 lines (30 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//GENERATING AN ARRAY OF N NUMBERS
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#include <fstream>
ofstream file; // FILE DECLARATION
typedef long long ll;
int main()
{
file.open("Test_Cases", ios::out | ios::trunc );
ll maxrange,maxsize,test;
maxrange=10; //MAXIMUM POSSIBLE VALUE OF THE ELEMENT
maxsize=10; //MAXIMUM SIZE OF THE ARRAY
test=10; //NUMBER OF TEST Test_Cases
file<<test<<"\n";
srand(time(0));
for(ll i=0;i<test;i++)
{
ll n=rand()%maxsize+1;
file<<n<<"\n";
for(ll j=0;j<n;j++)
{
ll a=rand()%maxrange+1;
file<<a<<" ";
}
file<<"\n";
}
file.close();
return 0;
}