STL Sort std sort include stdio h include

  • Slides: 10
Download presentation

STL Sort 사용방법(std: : sort) #include <stdio. h> #include <algorithm> //보통 STL이 적용된 헤더파일에는.

STL Sort 사용방법(std: : sort) #include <stdio. h> #include <algorithm> //보통 STL이 적용된 헤더파일에는. h확장자가 붙지않는다. using name space std; int main(){ int a[7]={2, 7, 6, 4, 1, 9, 8}; sort(a, a+7); //sort(sp, ep, comp식)인데 이때 comp식 처리는 번거로우므로 생략 return 0; }

STL Sort 사용방법(std: : stable_sort) #include <stdio. h> #include <algorithm> //보통 STL이 적용된 헤더파일에는.

STL Sort 사용방법(std: : stable_sort) #include <stdio. h> #include <algorithm> //보통 STL이 적용된 헤더파일에는. h확장자가 붙지않는다. using name space std; int main(){ int a[7]={2, 7, 6, 4, 1, 9, 8}; stable_sort(a, a+7); //stable_sort(sp, ep, comp식)인데 이때 comp식 처리는 번거로우므로 생략 return 0; } 이때 외관상 sort 대신 stable_sort로 바꾸면 된다.