Home > Back-end >  Unable to run
Unable to run

Time:12-07

#include
Int main ()
{
int a, b, c;
Int s [100], [100] p, q) [100].
Scanf_s (" % d % d % d ", & amp; A, & amp; B, & amp; C);
For (int I=0; I & lt; a; I++)
{
Scanf_s (" % d ", & amp; S [I]);
Int max1 [0]=s;
For (int I=0; I & lt; a; I++)
{
For (int t=0; T & lt; A - i& & I + 1 & lt; a; T++)
{
If (s [I] <=s [I + 1])
Max1=s [I + 1);
S=s [I] [I + 1];
S [I]=max1;
}
}
}
For (int I=0; I & lt; a; I++)
{
Printf (" % d ", s [I]);
}
return 0;
}

CodePudding user response:

The original poster to achieve? And I in two loops of the building Lord, and the second cycle is still in the first layer in the loop,

 # include 
Int main ()
{
int a, b, c;
Int s [100], [100] p, q) [100].

Scanf_s (" % d % d % d ", & amp; A, & amp; B, & amp; C);
If (a & gt; 100)
A=100;

For (int I=0; I & lt; a; I++)
{
Scanf_s (" % d ", & amp; S [I]);
}
Int max1 [0]=s;
For (int I=0; I & lt; a; I++)
{
For (int t=0; T & lt; A - i& & I + 1 & lt; a; T++)
{
If (s [I] <=s [I + 1])
Max1=s [I + 1);
S=s [I] [I + 1];
S [I]=max1;
}
}
For (int I=0; I & lt; a; I++)
{
Printf (" % d ", s [I]);
}
return 0;
}

For your reference ~

CodePudding user response:

The
reference 1/f, confident boy reply:
the original poster to achieve? And I in two loops of the building Lord, and the second cycle is still in the first layer in the loop,

 # include 
Int main ()
{
int a, b, c;
Int s [100], [100] p, q) [100].

Scanf_s (" % d % d % d ", & amp; A, & amp; B, & amp; C);
If (a & gt; 100)
A=100;

For (int I=0; I & lt; a; I++)
{
Scanf_s (" % d ", & amp; S [I]);
}
Int max1 [0]=s;
For (int I=0; I & lt; a; I++)
{
For (int t=0; T & lt; A - i& & I + 1 & lt; a; T++)
{
If (s [I] <=s [I + 1])
Max1=s [I + 1);
S=s [I] [I + 1];
S [I]=max1;
}
}
For (int I=0; I & lt; a; I++)
{
Printf (" % d ", s [I]);
}
return 0;
}

For reference ~

The purpose is to achieve from big to small order

CodePudding user response:

 # include 
Int main ()
{
int a, b, c;
Int s [100], [100] p, q) [100].

Scanf_s (" % d % d % d ", & amp; A, & amp; B, & amp; C);
If (a & gt; 100)
A=100;

For (int I=0; I & lt; a; I++)
{
Scanf_s (" % d ", & amp; S [I]);
}
Int max1;
For (int I=0; I & lt; a; I++)
{
Max1=I;
//for (int t=I; T & lt; A - i& & I + 1 & lt; a; T++)
For (int t=I; T & lt; a; T++)
{
If (s [max1] <=s [t])
Max1=t;

}
If (max1! I)={
Int TMP=s [I];
S [max1] [I]=s;
S [max1]=TMP;
}
}
For (int I=0; I & lt; a; I++)
{
Printf (" % d ", s [I]);
}
return 0;
}

For your reference ~

CodePudding user response:

reference 3 building self-confidence boy reply:
 # include 
Int main ()
{
int a, b, c;
Int s [100], [100] p, q) [100].

Scanf_s (" % d % d % d ", & amp; A, & amp; B, & amp; C);
If (a & gt; 100)
A=100;

For (int I=0; I & lt; a; I++)
{
Scanf_s (" % d ", & amp; S [I]);
}
Int max1;
For (int I=0; I & lt; a; I++)
{
Max1=I;
//for (int t=I; T & lt; A - i& & I + 1 & lt; a; T++)
For (int t=I; T & lt; a; T++)
{
If (s [max1] <=s [t])
Max1=t;

}
If (max1! I)={
Int TMP=s [I];
S [max1] [I]=s;
S [max1]=TMP;
}
}
For (int I=0; I & lt; a; I++)
{
Printf (" % d ", s [I]);
}
return 0;
}

For reference ~

Actually, I want to solve the problem of not code, I own the writing didn't run out, there must be a problem, I want to solve the problem of the compiler error, of course, also thank you very much for your answer,

CodePudding user response:

Visual is your code error
If (s [I] <=s [I + 1])
Max1=s [I + 1);
S=s [I] [I + 1];
S [I]=max1;
The less the brackets? It doesn't enter infinite loop?
If (s [I] <=s [I + 1]) {
Max1=s [I + 1);
S=s [I] [I + 1];
S [I]=max1;
} should be so,,, you can have a try

CodePudding user response:

Not recommended in Chinese directory, this directory is to use the default project?

CodePudding user response:

reference Buddha, 4/f, salted fish en reply:
Quote: refer to the third floor confident boy reply:
 # include 
Int main ()
{
int a, b, c;
Int s [100], [100] p, q) [100].

Scanf_s (" % d % d % d ", & amp; A, & amp; B, & amp; C);
If (a & gt; 100)
A=100;

For (int I=0; I & lt; a; I++)
{
Scanf_s (" % d ", & amp; S [I]);
}
Int max1;
For (int I=0; I & lt; a; I++)
{
Max1=I;
//for (int t=I; T & lt; A - i& & I + 1 & lt; a; T++)
For (int t=I; T & lt; a; T++)
{
If (s [max1] <=s [t])
Max1=t;

}
If (max1! I)={
Int TMP=s [I];
S [max1] [I]=s;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related