求大神解惑,输出不对,求求了,(顺便说说,我是新手)谢谢
/*输入十个数,将最大的数排到第一位,最大数排到最后一位用三个函数(1)输入十个数(2)处理函数(3)输出函数*/
#include<iostream>
using namespace std;
void input(int*shuzhu)
{
cout<<"请输入10个整数:";
for(int i=0;i<10;i++)
cin>>shuzhu[i];
}
void chuli(int*shuzhu)
{
int nummin=*shuzhu,nummax=*shuzhu,q,w,tmp;
for(int j=1;j<=10;j++)
if(nummin>*(shuzhu+j))
q=j;
if(nummax<*(shuzhu+j))
w=j;
tmp=*(shuzhu+q);
*(shuzhu+q)=*shuzhu;
*shuzhu=tmp;
tmp=*(shuzhu+w);
*(shuzhu+w)=*(shuzhu+9);
*(shuzhu+9)=tmp;
}
void output(int*shuzhu)
{
cout<<"处理后的排序为:";
for(int i=0;i<10;i++)
cout<<shuzhu[i]<<" ";
}
int main()
{
int number[10];
input(number);
chuli(number);
output(number);
return 0;
}