#include
#include
using namespace std;
void sort1(int arraya[],int n)
{
for(int i=0;i<=n-1;i++)
{
for(int j=0;j{
if (arraya[j]>arraya[j+1])
{
int temp=0;
temp=arraya[j];
arraya[j]=arraya[j+1];
arraya[j+1]=temp;
}
}
}
}
int main()
{
int a[]={2,1,4,3,7,5,8,6};
int n=sizeof(a)/sizeof(int);
sort1(a,n);
for(int i=0;i<=n-1;i++)
{
cout< }
cout<return 0;
system("pause");
}
int temp=0;
这里应该在函数最开始的时候定义吧,不应该在中间定义。
文件出错了 修复看看