[HUST CSE][WCH][library] fix error in Bubble Sort (#7240)

This commit is contained in:
AD0naldRavenclow 2023-04-24 12:49:24 +08:00 committed by GitHub
parent 17ed572644
commit fec989a69f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -1071,12 +1071,12 @@ int16_t Get_CalibrationValue(ADC_TypeDef* ADCx)
buf[i] = ADCx->RDATAR;
}
for(i=0; i<10; i++){
for(j=0; j<10; j++){
for(i=0; i<9; i++){
for(j=0; j<9-i; j++){
if(buf[j]>buf[j+1]){
t=buf[j];
buf[j]=buf[j+1];
buf[j]= t;
buf[j+1]= t;
}
}
}

View File

@ -1124,12 +1124,12 @@ int16_t Get_CalibrationValue(ADC_TypeDef *ADCx)
buf[i] = ADCx->RDATAR;
}
for(i = 0; i < 10; i++){
for(j = 0; j < 10; j++){
for(i = 0; i < 9; i++){
for(j = 0; j < 9 - i; j++){
if(buf[j] > buf[j + 1]){
t = buf[j];
buf[j] = buf[j + 1];
buf[j] = t;
buf[j + 1] = t;
}
}
}