//input 10 integers, one of the largest number with the number 1
#include
using namespace std;
Int main ()
{
Void fun (int *);
Int a [10], * p, I;
P=a;
for(i=0; i<10; I++)
Cin> A, [I].
Fun (a);
for(i=0; i<10; I++)
Coutreturn 0;
}
Void fun (int * p)
{
Int I, j, t, k=0;
For (I=k; i<9. I++)
{
for(j=i+1; J<10; J++)
{
If (* (p + I) & lt; * (p + j))
{
K=j;
break;
}
}
}
T=* p;
* p=* (p + k);
* (p=t + k);
}
CodePudding user response:
You this is a little trouble, if simply exchange the biggest and the first words, you can consider this, I changed the fun function on the basis of you,# include
using namespace std;
Void fun (int *);
Int main ()
{
Int a [10], I;
Cout & lt; <"Please input the number 10:" & lt;for (i=0; i <10; I++)
{
Cin & gt;> A, [I].
}
Fun (a);
Cout & lt; <"After the exchange:" & lt;for (i=0; i <10; I++)
{
Cout & lt; }
return 0;
}
Void fun (int * p)
{
int k=0;
For (int I=0; i <10; I++)
{
If (p [I] & gt; P [k])
{
K=I;
}
}
Int temp=p [0];
P=p [0] [k].
P=\ [k];
}
CodePudding user response: