Aktualizovat „du5/program.c“

This commit is contained in:
Artem Horbunov 2020-04-07 15:28:14 +00:00
parent 0f7b5e48cc
commit 17091fb629

View File

@ -44,10 +44,10 @@ int main(){
} }
} }
// printf("Unsorted:\n"); printf("Unsorted:\n");
// for(int i = 0; i < newPos; i++){ for(int i = 0; i < newPos; i++){
// printf("%d %s\n", newScore[i], newName[i]); printf("%d %s\n", newScore[i], newName[i]);
// } }
//Sorting //Sorting
for(int d = 0; d < newPos - 1; d++){ for(int d = 0; d < newPos - 1; d++){
@ -66,8 +66,9 @@ int main(){
else if(newScore[i] == newScore[i + 1]){ //Name sorting else if(newScore[i] == newScore[i + 1]){ //Name sorting
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]){ printf("--Testing--\n");
// printf("Letters %c %c\n", newName[i][pos], newName[i + 1][pos]); if(newName[i][q] > newName[i + 1][q]){
printf("Letters |%c %c|\n", newName[i][q], newName[i + 1][q]);
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;
@ -76,10 +77,10 @@ int main(){
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);
// printf("If\n"); printf("|If|\n");
break; break;
} }
else if(newName[i][pos] > newName[i + 1][pos]){ else if(newName[i][q] < newName[i + 1][q]){
// 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;
@ -88,9 +89,15 @@ int main(){
// 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);
// printf("Else if\n"); printf("|Else if|\n");
break; break;
} }
// else if(newName[i][q] == newName[i + 1][q]){
// printf("Letters |%c %c|\n", newName[i][q], newName[i + 1][q]);
// }
// else{
// printf("WTF\n");
// }
} }
} }
} }