answersLogoWhite

0

#include<iostream>

#include<random>

#include<ctime>

#include<algorithm>

int main()

{

std::default_random_engine generator ((unsigned) time (0));

std::uniform_int_distribution<unsigned> range (1, 60);

std::uniform_int_distribution<unsigned> value (1, 100);

int sorting[60] = {};

size_t max = range (generator);

std::cout << "Unsorted:\t";

for (size_t i=0; i<max; ++i)

{

sorting[i] = value (generator);

std::cout << sorting[i] << ' ';

}

std::cout << std::endl;

std::sort (&sorting[0], &sorting[0]+max);

std::cout << "Sorted:\t\t";

for (size_t i=0; i<max; ++i)

{

std::cout << sorting[i] << ' ';

}

std::cout << std::endl;

}

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

A program c plus plus on automorphic numbers or not?

how to write a program that counts automorphic number from 1 to 999


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


Would you Write c plus plus program using array for Fibonacci number?

You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....


Array implementation of priority queue example program in c plus plus?

yes


Can you help me with the C plus plus code of the program which has 10 index of array it adds 5 into every even elements of the array and then it subtracts 10 into the odd elements of the array?

int array[10] = {...}; for (int i = 0; i &lt; 10; ++i) { if (i % 2 == 0) array[i] += 5; else array[i] -= 10; }


Write a program in c plus plus for finding the sum of first 10 even numbers?

int i, sum = 0; for (i=0; i&lt;20; i+=2) sum+=i;


Can you write a program to read a set of scores from a file and compute the average and print it on the screenby c plus plus?

Yes. Use cin and/or getline to read the formatted data into an array, compute the average then output the result using cout.


What is single dimensional array in c plus plus?

A one dimensional array is an array of objects that goes in one "direction". Any array with only one [] is a one dimensional array. For example: int numbers[6]; is a one dimensional array. int numbers[6][3]; is a two dimensional array.Graphical terms:One dimensional array[4]:14 - 75 - 8164 - 234Two dimensional array[2][3]:47 - 178108 - 8517 - 128It didn't come out quite how I wanted it...


How to write a code for finding sum of left diagonals elements in an array using c plus plus?

truzi i Ghal


How calculate the average scored by student for is subject in c plus plus program?

Put all the values in an array, iterate through the array with a for loop, sum all the values, then divide by the count of the values.


Write a program in c plus plus language to add 2 numbers?

int main() { int num1; int num2; int result = num1 + num2; return 0; }


How do you write a program in c plus plus to check if an array is symmetric?

To determine if an array is symmetric, the array must be square. If so, check each element against its transpose. If all elements are equal, the array is symmetric.For a two-dimensional array (a matrix) of order n, the following code will determine if it is symmetric or not:templatebool symmetric(const std::array& matrix){for (size_t r=0 ; r