关于C++的题目,求详细解答,谢谢!!

2025-02-23 22:05:30
推荐回答(1个)
回答1:

void SortIntegerArray(int a[], int n){
int i,j,temp;n--;
for(i=0;ifor(j=0;jif(a[j]>a[j+1]){temp=a[j];a[j]=a[j+1];a[j+1]=temp;}
};
#include
#define N 10
void main()
{
int i,array[N];
printf(\"Input the number to be sorted:\");
for(i=0;iscanf(\"%d\",&array[i]);

SortIntegerArray(array,N);

for(i=0;iprintf(\"%d \",array[i]);