-
Notifications
You must be signed in to change notification settings - Fork 1
/
RandomData.h
41 lines (32 loc) · 938 Bytes
/
RandomData.h
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
33
34
35
36
37
38
39
40
#include <vector>
#include "NormalData.h"
#pragma once
using namespace std;
// I: length the size of the array
void initializeArray(int A[], int length);
void initializeRandomVector(vector<int> &v, int length);
void initializeMRandomVector(vector<int> &v, int length);
void initialize2DRandomVector(vector<vector<int> > &v, int rows, int columns);
void initializeRandomIndexVector(vector<int> &v, const int size);
void initializeRandomStringArray(char S[], int length);
void initializeRandomString(string &S, int length);
void printStringArray(char S[], int length);
template<typename T>
void printArray(T A[], int p, int r)
{
int column = 0;
for (int i = p; i <= r; ++i)
{
cout << A[i] << "\t";
if (column++ % COLUMNS == COLUMNS - 1)
{
cout << endl;
}
}
cout << endl;
}
template<typename T>
void printArray(T A[], int length)
{
printArray(A, 0, length - 1);
}