Aktualizovat „du5/program.c“
This commit is contained in:
parent
7e66c53777
commit
45fc4c1d3d
@ -41,46 +41,46 @@ int main(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < newPos - 1; i++){
|
for(int d = 0; d < newPos - 1; d++){
|
||||||
if(newScore[i] < newScore[i + 1]){
|
for(int i = 0; i < newPos - 1; i++){
|
||||||
int tmpScore = newScore[i];
|
if(newScore[i] < newScore[i + 1]){
|
||||||
newScore[i] = newScore[i + 1];
|
int tmpScore = newScore[i];
|
||||||
newScore[i + 1] = tmpScore;
|
newScore[i] = newScore[i + 1];
|
||||||
|
newScore[i + 1] = tmpScore;
|
||||||
|
|
||||||
char tmpName[50];
|
char tmpName[50];
|
||||||
strcpy(tmpName, newName[i]);
|
strcpy(tmpName, newName[i]);
|
||||||
strcpy(newName[i], newName[i + 1]);
|
strcpy(newName[i], newName[i + 1]);
|
||||||
strcpy(newName[i + 1], tmpName);
|
strcpy(newName[i + 1], tmpName);
|
||||||
|
|
||||||
i = -1;
|
}
|
||||||
}
|
else if(newScore[i] == newScore[i + 1]){
|
||||||
else if(newScore[i] == newScore[i + 1]){
|
int test = 0;
|
||||||
int test = 0;
|
for(int q = 0; q < newPos; q++){
|
||||||
for(int q = 0; q < newPos; q++){
|
if(newName[i][pos] < newName[i + 1][pos]){
|
||||||
if(newName[i][pos] < newName[i + 1][pos]){
|
int tmpScore = newScore[i];
|
||||||
int tmpScore = newScore[i];
|
newScore[i] = newScore[i + 1];
|
||||||
newScore[i] = newScore[i + 1];
|
newScore[i + 1] = tmpScore;
|
||||||
newScore[i + 1] = tmpScore;
|
|
||||||
|
|
||||||
char tmpName[50];
|
char tmpName[50];
|
||||||
strcpy(tmpName, newName[i]);
|
strcpy(tmpName, newName[i]);
|
||||||
strcpy(newName[i], newName[i + 1]);
|
strcpy(newName[i], newName[i + 1]);
|
||||||
strcpy(newName[i + 1], tmpName);
|
strcpy(newName[i + 1], tmpName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
int tmpScore = newScore[i + 1];
|
int tmpScore = newScore[i + 1];
|
||||||
newScore[i + 1] = newScore[i];
|
newScore[i + 1] = newScore[i];
|
||||||
newScore[i] = tmpScore;
|
newScore[i] = tmpScore;
|
||||||
|
|
||||||
char tmpName[50];
|
char tmpName[50];
|
||||||
strcpy(tmpName, newName[i + 1]);
|
strcpy(tmpName, newName[i + 1]);
|
||||||
strcpy(newName[i + 1], newName[i]);
|
strcpy(newName[i + 1], newName[i]);
|
||||||
strcpy(newName[i], tmpName);
|
strcpy(newName[i], tmpName);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user