对数组元素随机赋值,冒泡排序,输出数组

//实现给数组中的元素随机赋值
void assignment(int a[],int count){
    for (int i = 0; i < count; i++) {
        a[i] = arc4random()%100;
    }
}
//实现给数组排序,升序序列。
void order(int a[],int count)
{
    for (int i = 0;i < count - 1;i++){
        for (int j = 0;j < count - 1 - i;j++){
            if(a[j] > a[j + 1]){
                int temp = 0;
                temp = a[j];
                a[j] = a[j + 1];
                a[j + 1] = temp;
            }
        }
    }
}
//实现将数组元素输出
void  output(int a[],int count)
{
    for (int i = 0; i < count;i ++) {
        printf("%d ",a[i]);
    }
}

你可能感兴趣的:(对数组元素随机赋值,冒泡排序,输出数组)