1         NSMutableArray *arrM = [NSMutableArray arrayWithObjects:@"5", @"6", @"7", @"3", @"4", nil];
 2         
 3         NSUInteger count = arrM.count;
 4         for (NSUInteger i = 0; i < count; i++) {
 5             for (NSUInteger j = i+1; j < count; j++) {
 6                 int a = [arrM[i] intValue];
 7                 int b = [arrM[j] intValue];
 8                 if (a < b) {
 9                     arrM[i] = [NSString stringWithFormat:@"%d", b];
10                     arrM[j] = [NSString stringWithFormat:@"%d", a];
11                 }
12             }
13         }
14         NSLog(@"%@",arrM);    

 

相关文章:

  • 2022-12-23
  • 2022-01-07
  • 2021-10-26
  • 2022-01-25
  • 2021-12-27
  • 2021-05-31
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-02
  • 2021-06-18
  • 2021-04-14
  • 2022-12-23
  • 2022-01-04
相关资源
相似解决方案