You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
613 B
38 lines
613 B
#include <iostream> |
|
#include <random> |
|
using std::cout; |
|
using std::cin; |
|
|
|
#include "dynarray.hpp" |
|
|
|
int main() { |
|
size_t n; |
|
cout << "How many numbers to generate? "; |
|
cin >> n; |
|
|
|
std::default_random_engine r_eng; |
|
DynArray<std::default_random_engine::result_type> arr; |
|
for (auto i = 0; i < n; i++) |
|
{ |
|
arr << r_eng(); |
|
} |
|
cout << '\n'; |
|
|
|
cout << "Size: " << arr.size() << '\n'; |
|
cout << "Capacity: " << arr.capacity() << '\n'; |
|
cout << "Elements: ["; |
|
bool first = true; |
|
for (auto elem : arr) |
|
{ |
|
if (!first) { |
|
cout << ", "; |
|
} |
|
else { |
|
first = false; |
|
} |
|
cout << elem; |
|
} |
|
cout << "]\n"; |
|
|
|
return 0; |
|
} |