#define _crt_secure_no_warnings
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
void main()
{
int num;
void orderarray(int a[], int num);
void printfarray(int a[], int num);
printf("please input the data ");
int a[] = { 33, 44, 22, 3, 2, 5, 99, 809, 879};
num = sizeof(a) / sizeof(a[0]);
printf("num:%d ", num);
printf("排序之前 ");
printfarray(a, num);
printf("排序之后 ");
orderarray(a, num);
printfarray(a, num);
system("pause");
return;
}
{
int num;
void orderarray(int a[], int num);
void printfarray(int a[], int num);
printf("please input the data ");
int a[] = { 33, 44, 22, 3, 2, 5, 99, 809, 879};
num = sizeof(a) / sizeof(a[0]);
printf("num:%d ", num);
printf("排序之前 ");
printfarray(a, num);
printf("排序之后 ");
orderarray(a, num);
printfarray(a, num);
system("pause");
return;
}
void orderarray(int a[],int num)
{
int i, j, temp;
for (i = 0; i < num; i++)
{
for (j = i + 1; j < num; j++)
{
if (a[i]>a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
//return a;
}
void printfarray(int a[], int num)
{
int i, j, temp;
for (i = 0; i < num; i++)
{
for (j = i + 1; j < num; j++)
{
if (a[i]>a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
//return a;
}
void printfarray(int a[], int num)
{
int i;
for (i = 0; i < num; i++)
{
printf("%d ",a[i]);
}
printf(" ");
return;
}
int i;
for (i = 0; i < num; i++)
{
printf("%d ",a[i]);
}
printf(" ");
return;
}