Home > Back-end >  Ask bosses, this how should I change, thank you
Ask bosses, this how should I change, thank you

Time:09-24

Code:
# include
Int main () {
Int a [50], [3] b, m, * p * q;
P=a;
Q=b;
Printf (" m: ");
The scanf (" % d ", & amp; M);
Printf (" a: ");
For (p=a; pThe scanf (" % d ", p);
Printf (" b: ");
The scanf (" % d ", q);
For (p=a; p
For (q=b; QIf (* p> * q)
* p=* q;
}
A: printf (" % d ", p);
return 0;
}

CodePudding user response:

 # include 
Int main () {
Int a [50], [3] b, m (0), * p * q;
P=a;
Q=b;
Printf (" m: ");
while(! (m> 0 & amp; & M<=47))
The scanf (" % d ", & amp; M);
Printf (" a: ");
For (p=a; p
The scanf (" % d ", p);
Printf (" b: ");
For (q=b; Q & lt; B + 3; Q++)
The scanf (" % d ", q);

Int temp.
For (q=b; QFor (p=a; P & lt; A + m + - b (q); P++) {
If (* p & gt;//and then * q) in
{
Temp=* p;
* p=* q;
* q=temp;
}
}
* p=temp;//fill out
}

Printf (" a: ");
for (int i=0; I & lt; M + 3; I++) {
Printf (" % d ", a [I]);
}
return 0;
}

CodePudding user response:

reference 1st floor bo_self_effacing response:
 # include 
Int main () {
Int a [50], [3] b, m (0), * p * q;
P=a;
Q=b;
Printf (" m: ");
while(! (m> 0 & amp; & M<=47))
The scanf (" % d ", & amp; M);
Printf (" a: ");
For (p=a; p
The scanf (" % d ", p);
Printf (" b: ");
For (q=b; Q & lt; B + 3; Q++)
The scanf (" % d ", q);

Int temp.
For (q=b; QFor (p=a; P & lt; A + m + - b (q); P++) {
If (* p & gt;//and then * q) in
{
Temp=* p;
* p=* q;
* q=temp;
}
}
* p=temp;//fill out
}

Printf (" a: ");
for (int i=0; I & lt; M + 3; I++) {
Printf (" % d ", a [I]);
}
return 0;
}

Excuse me, would you please tell me how this should be how to understand, I want to know this isn't so, thank you
For (q=b; QFor (p=a; P & lt; A + m + - b (q); P++) {
If (* p & gt;//and then * q) in
{
Temp=* p;
* p=* q;
* q=temp;
}
}
* p=temp;//fill out
}

CodePudding user response:

refer to the second floor just learning programming rookie reply:
Quote: refer to 1st floor bo_self_effacing response:
 # include 
Int main () {
Int a [50], [3] b, m (0), * p * q;
P=a;
Q=b;
Printf (" m: ");
while(! (m> 0 & amp; & M<=47))
The scanf (" % d ", & amp; M);
Printf (" a: ");
For (p=a; p
The scanf (" % d ", p);
Printf (" b: ");
For (q=b; Q & lt; B + 3; Q++)
The scanf (" % d ", q);

Int temp.
For (q=b; QFor (p=a; P & lt; A + m + - b (q); P++) {
If (* p & gt;//and then * q) in
{
Temp=* p;
* p=* q;
* q=temp;
}
}
* p=temp;//fill out
}

Printf (" a: ");
for (int i=0; I & lt; M + 3; I++) {
Printf (" % d ", a [I]);
}
return 0;
}

Excuse me, would you please tell me how this should be how to understand, I want to know this isn't so, thank you
For (q=b; QFor (p=a; P & lt; A + m + - b (q); P++) {
If (* p & gt;//and then * q) in
{
Temp=* p;
* p=* q;
* q=temp;
}
}
* p=temp;//fill out
}
is the insertion sort, combine the inside of the b value in to a plug, plug is in the process of exchange value than he, at that time the value of b is already inserted, and then insert b into position behind the went back to move a value in this position, so it is inserted, change, circular plug, change is realized, after check all the values of a temp or * q value now is merged a greatest value in the array, put him in a final one, this is to fill in,

CodePudding user response:

Oh oh oh, I see, thank you for your bosses
  • Related