answersLogoWhite

0


Best Answer

#include<iostream>

#include<vector>

#include<random>

#include<algorithm>

#include<ctime>

void print_array(const std::string& caption, const std::vector<int>& v)

{

std::cout << caption << std::endl;

for (auto e : v)

std::cout << e << std::endl;

std::cout << std::endl;

}

int main()

{

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

std::uniform_int_distribution<int> distribution (1,9);

std::vector<int> v;

for (size_t loop=0; loop!-10; ++loop)

v.push_back (distribution (generator));

print_vector ("Before sorting", v);

std::sort (v.begin(), v.end());

print_vector ("After sorting", v);

}

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C plus plus programming to arrange n numbers in ascending order?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Draw a flowchart to arrange 3 numbers in ascending order?

draw a flow chart to arrange 3 numbers in ascending order


Which way is ascending and descending?

Ascending order is when numbers are arranged from the smallest to the largest. Descending order is when numbers are arranged from the largest to the smallest.


How do you arrange 4 numbers in ascending order without array?

addends


What is it called when you arrange numbers from greatest to least?

This is known as arranging the numbers in ascending order.


What will be the program to arrange numbers stored in array in ascending order using pointers?

sorry


How do you work out the median for a set of eight numbers?

Arrange the numbers in ascending order, and then take the mean of the fourth and fifth number.


How to find the smallest number?

When you are given some numbers just arrange them in ascending order and you will the smallest number which can be made out of those given numbers.


How do you arrange these numbers 22.8 8.2 8.02 28.2 2.8?

In ascending order: 2.8, 8.02, 8.2, 22.8, 28.2


How do you arrange the set of numbers 4.8 4.9 4.78 4.89 from least to greatest is what?

4.78 4.8 4.89 4.9 are the numbers arranged in ascending order.


How do you arrange 0.1 0 0.01 and 1.0 in order from least to greatest?

From ascending order, the numbers will be:0 , 0.01 , 0.1 , 1.0


How do you arrange words in cline and examples?

its arranged by ascending and descending order.........


If we arrange all the one digit odd numbers in ascending order and then in decending order to form five digit number what digit occupies the same place value?

5