help help to build array for numbers and sort
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
#include <stdio.h>
int main()
{
int y[] = 0;
int p;
srand((unsigned) time(&t));
for (p = 0; p < 20; p++)
{
y[p] = rand() % 20 + 1;
}
|
this will make me 20 numbers but and not sure about sorting
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <cstdio>
#include <algorithm>
int main()
{
int y[20];
srand((unsigned) time(&t));
for (p = 0; p < 20; p++)
{
y[p] = rand() % 20 + 1;
}
std::sort(y, y + 20);
}
|
http://www.cplusplus.com/articles/NhA0RXSz/
thank you for help
looks good
things become so standard eh that maybe
we no longer know how to program a sort function?
Topic archived. No new replies allowed.