Aktualizovat „du5/program.c“
This commit is contained in:
parent
0f7b5e48cc
commit
17091fb629
@ -44,10 +44,10 @@ int main(){
|
||||
}
|
||||
}
|
||||
|
||||
// printf("Unsorted:\n");
|
||||
// for(int i = 0; i < newPos; i++){
|
||||
// printf("%d %s\n", newScore[i], newName[i]);
|
||||
// }
|
||||
printf("Unsorted:\n");
|
||||
for(int i = 0; i < newPos; i++){
|
||||
printf("%d %s\n", newScore[i], newName[i]);
|
||||
}
|
||||
|
||||
//Sorting
|
||||
for(int d = 0; d < newPos - 1; d++){
|
||||
@ -66,8 +66,9 @@ int main(){
|
||||
else if(newScore[i] == newScore[i + 1]){ //Name sorting
|
||||
int test = 0;
|
||||
for(int q = 0; q < newPos; q++){
|
||||
if(newName[i][pos] < newName[i + 1][pos]){
|
||||
// printf("Letters %c %c\n", newName[i][pos], newName[i + 1][pos]);
|
||||
printf("--Testing--\n");
|
||||
if(newName[i][q] > newName[i + 1][q]){
|
||||
printf("Letters |%c %c|\n", newName[i][q], newName[i + 1][q]);
|
||||
int tmpScore = newScore[i];
|
||||
newScore[i] = newScore[i + 1];
|
||||
newScore[i + 1] = tmpScore;
|
||||
@ -76,10 +77,10 @@ int main(){
|
||||
strcpy(tmpName, newName[i]);
|
||||
strcpy(newName[i], newName[i + 1]);
|
||||
strcpy(newName[i + 1], tmpName);
|
||||
// printf("If\n");
|
||||
printf("|If|\n");
|
||||
break;
|
||||
}
|
||||
else if(newName[i][pos] > newName[i + 1][pos]){
|
||||
else if(newName[i][q] < newName[i + 1][q]){
|
||||
// int tmpScore = newScore[i + 1];
|
||||
// newScore[i + 1] = newScore[i];
|
||||
// newScore[i] = tmpScore;
|
||||
@ -88,9 +89,15 @@ int main(){
|
||||
// strcpy(tmpName, newName[i + 1]);
|
||||
// strcpy(newName[i + 1], newName[i]);
|
||||
// strcpy(newName[i], tmpName);
|
||||
// printf("Else if\n");
|
||||
printf("|Else if|\n");
|
||||
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");
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user