哪位达人来帮我检查下,我的冒泡排序法那里错了。。。。。
#include<iostream.h>void main()
{
int nCount,nCount1;
int nNum[10],nSum;
nCount=0;
while(nCount<=9)
{
cout<<"输入第"<<nCount+1<<"个数:\t";
cin>>nNum[nCount];
nCount=nCount+1;
}
for(nCount=nCount+1;nCount<=8;nCount=nCount+1)
{
for(nCount1=nCount1+1;nCount1<=9;nCount1=nCount1+1)
{
if(nNum[nCount]<nNum[nCount1])
{
nSum=nNum[nCount];
nNum[nCount]=nNum[nCount1];
nNum[nCount1]=nSum;
}
}
}
for(nCount=0;nCount<=9;nCount=nCount+1)
{
cout<<nNum[nCount]<<" ";
}
cout<<endl;
}
这就是图片,我怎么输的,它就怎么显示,完全不排顺序。。。。我实在检查不出哪里有问题
还请各位高手帮我看看,小弟我感激不尽!!!