본문 바로가기
728x90
반응형

STL24

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.
for_each for_each #include #include #include #include using namespace std; void func(string str) { cout 2023. 12. 9.
search #include #include #include using namespace std; void main() { int ar1[]={3,1,4,1,5,9,2,6,5,3,5,8,9,9,9,3,2,3,1,5,9,2,6,4,3}; int ar2[]={1,5,9}; int *p; p=search(&ar1[0],&ar1[25],&ar2[0],&ar2[3]); if (p!=&ar1[25]) { printf("%d번째에서 구간이 발견되었습니다.\n",p-ar1); } p=find_end(&ar1[0],&ar1[25],&ar2[0],&ar2[3]); if (p!=&ar1[25]) { printf("%d번째에서 구간이 발견되었습니다.\n",p-ar1); } p=search_n(&ar1[0],&ar1[25],3,9); if.. 2023. 12. 9.
728x90
반응형