Gx
2014-04-23 21:53:56 UTC
Have it printing out random numbers but cant figure out how to sort them.
#include
#include
#include
using namespace std;
int main()
{
int TenRand[10], i, TenInOrder[10], j, a;
srand(time(0));
for (i=0; i<10; i++)
TenRand[i]=rand()%100+1;
for (i=0; i<10; i++)
{
for (j=0; j<100; j++)
{
if (TenRand[i]==j)
TenInOrder[i]=TenRand[i];
}
}
for (i=0; i<10; i++)
{
cout << TenInOrder[i] << endl;
}
return 0;
}
Any ideas?