본문 바로가기
728x90
반응형

전체 글153

generate, remove, remove_copy, unique generate #include #include #include using namespace std; template void dump(const char *desc, C c) { cout.width(12);cout 2023. 12. 9.
random_shuffle random_shuffle #include #include using namespace std; void main() { char str[]="abcdefghijklmnopqrstuvwxyz"; randomize(); puts(str); random_shuffle(&str[0],&str[strlen(str)]);puts(str); random_shuffle(&str[0],&str[strlen(str)]);puts(str); random_shuffle(&str[0],&str[strlen(str)]);puts(str); } 2023. 12. 9.
fill fill #include #include #include using namespace std; template void dump(const char *desc, C c) { cout.width(12);cout 2023. 12. 9.
copy #include #include #include using namespace std; template void dump(const char *desc, C c) { cout.width(12);cout 2023. 12. 9.
count count #include #include using namespace std; void main() { const char *str="Oh baby baby,How was I supposed to know " "That something wasn't right here"; size_t num; num=count(&str[0],&str[strlen(str)+1],'a'); printf("이 문장에는 a가 %d개 있습니다.\n",num); } count_if #include #include #include using namespace std; void main() { const char *str="Oh baby baby,How was I supposed to know " "That something was.. 2023. 12. 9.
mstmatch mstmatch #include #include #include using namespace std; void main() { int ari[]={8,9,0,6,2,9,9}; vector vi(&ari[0],&ari[7]); vi[3]=7; pair p; p=mismatch(&ari[0],&ari[7],vi.begin()); if (p.first != &ari[7]) { printf("%d번째 자리(%d,%d)부터 다르다.\n", p.first-ari,*(p.first),*(p.second)); } else { puts("두 컨테이너가 일치한다."); } } mstmatch2 #include #include #include using namespace std; void main() { int answer.. 2023. 12. 9.
728x90
반응형