Aktualizovat „du5/program.c“

This commit is contained in:
Artem Horbunov 2020-04-07 14:45:58 +00:00
parent 7e66c53777
commit 45fc4c1d3d

View File

@ -41,46 +41,46 @@ int main(){
}
}
for(int i = 0; i < newPos - 1; i++){
if(newScore[i] < newScore[i + 1]){
int tmpScore = newScore[i];
newScore[i] = newScore[i + 1];
newScore[i + 1] = tmpScore;
for(int d = 0; d < newPos - 1; d++){
for(int i = 0; i < newPos - 1; i++){
if(newScore[i] < newScore[i + 1]){
int tmpScore = newScore[i];
newScore[i] = newScore[i + 1];
newScore[i + 1] = tmpScore;
char tmpName[50];
strcpy(tmpName, newName[i]);
strcpy(newName[i], newName[i + 1]);
strcpy(newName[i + 1], tmpName);
char tmpName[50];
strcpy(tmpName, newName[i]);
strcpy(newName[i], newName[i + 1]);
strcpy(newName[i + 1], tmpName);
i = -1;
}
else if(newScore[i] == newScore[i + 1]){
int test = 0;
for(int q = 0; q < newPos; q++){
if(newName[i][pos] < newName[i + 1][pos]){
int tmpScore = newScore[i];
newScore[i] = newScore[i + 1];
newScore[i + 1] = tmpScore;
}
else if(newScore[i] == newScore[i + 1]){
int test = 0;
for(int q = 0; q < newPos; q++){
if(newName[i][pos] < newName[i + 1][pos]){
int tmpScore = newScore[i];
newScore[i] = newScore[i + 1];
newScore[i + 1] = tmpScore;
char tmpName[50];
strcpy(tmpName, newName[i]);
strcpy(newName[i], newName[i + 1]);
strcpy(newName[i + 1], tmpName);
break;
}
else{
int tmpScore = newScore[i + 1];
newScore[i + 1] = newScore[i];
newScore[i] = tmpScore;
char tmpName[50];
strcpy(tmpName, newName[i]);
strcpy(newName[i], newName[i + 1]);
strcpy(newName[i + 1], tmpName);
break;
}
else{
int tmpScore = newScore[i + 1];
newScore[i + 1] = newScore[i];
newScore[i] = tmpScore;
char tmpName[50];
strcpy(tmpName, newName[i + 1]);
strcpy(newName[i + 1], newName[i]);
strcpy(newName[i], tmpName);
break;
char tmpName[50];
strcpy(tmpName, newName[i + 1]);
strcpy(newName[i + 1], newName[i]);
strcpy(newName[i], tmpName);
break;
}
}
}
i = -1;
}
}