#include<iostream>
#include<stdlib.h>
#include<time.h>
using namespace std; int main(void)
{ int array[];
int RANGE_MIN = ;
int RANGE_MAX = ;
for (int i = ; i < ; i++)
{
int rand100 = (((double) rand() /
(double) RAND_MAX) * RANGE_MAX + RANGE_MIN);
cin >> array[i]; }
int temp; for (int i = ; i < ; i++)
for (int j = ; j < - i; j++)
{
if (array[j] > array[j + ])
{
temp = array[j];
array[j] = array[j + ];
array[j + ] = temp;
}
}
for (int i = ; i < ; i++)
cout << array[i] << " ";
system("pause");
}
 #include<iostream>
#include<stdlib.h>
#include<time.h>
using namespace std; int main(void)
{
int *arrayflag = new int;
int array[];
int RANGE_MIN = ;
int RANGE_MAX = ;
for (int i = ; i < ; i++)
{
int rand100 = (((double) rand() /
(double) RAND_MAX) * RANGE_MAX + RANGE_MIN);
array[i]=rand100; }
int temp; for (int i = ; i < ; i++)
for (int j = ; j < - i; j++)
{
if (array[j] > array[j + ])
{
temp = array[j];
array[j] = array[j + ];
array[j + ] = temp;
}
}
//for (int i = 0; i < 100; i++)
//cout << array[i] << " ";
int i = , left = ;
while (i < )
arrayflag[i++] = false; //初始化标志数组 for (i = ; i < ; i++)//剔除算法
{
arrayflag[array[i]] = array[i]; //将出现过的数保存到对应的位置 }
for (i = ; i < ; i++) //取出有效数
{
if (arrayflag[i] != false)
{
array[left++] = arrayflag[i];
} }
for (i = ; i < left-; i++)
cout << array[i] << " ";
system("pause");
}
 #include<iostream>
using namespace std; int main()
{
int a[] = { , , , , }, b[] = { , , , , };
int *c = new int;
int k=,j=;
for (int i = ; i < ; i++)
{
if (a[j] > b[k])
{
c[i] = a[j];
j--;
}
else
{
c[i] =b[k];
k--;
}
}
for (int i = ; i < ; i++)
cout << c[i] << " ";
}
04-27 07:42