-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path28CopyArray.cpp
46 lines (43 loc) · 1011 Bytes
/
28CopyArray.cpp
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
41
42
43
44
45
46
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int RandomNumber(int From, int To)
{
int randNUmber = rand() % (To - From + 1) + From;
return randNUmber;
}
void ReadyFillArraywhitNumber(int Array[100], int &Length)
{
cout << "Enter The Elements Array " << endl;
cin >> Length;
for (size_t i = 0; i < Length; i++)
{
Array[i] = RandomNumber(1, 100);
}
}
void PrintArray(int Array[100], int Length)
{
for (size_t i = 0; i < Length; i++)
{
cout << Array[i] << " ";
}
}
void PrintCopyArray(int Array[100], int Length)
{
for (size_t i = 0; i < Length; i++)
{
cout << Array[i] << " ";
}
}
int main(int argc, char const *argv[])
{
srand((unsigned)time(NULL));
int Array[100], length;
ReadyFillArraywhitNumber(Array, length);
cout << "The Elements Number " << ": ";
PrintArray(Array, length);
cout << "\nArray 2 elements after copy : ";
PrintCopyArray(Array,length);
return 0;
}