본문 바로가기
프로그래밍 기록/stl

for_each

by hominic 2023. 12. 9.
728x90
반응형

for_each

 

반응형
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

void func(string str)
{
	cout << str << endl;
}

void main()
{
	vector<string> vs;
	vs.push_back("로보트 태권 브이");
	vs.push_back("들장미 소녀 캔디");
	vs.push_back("바보 온달과 평강 공주");
	vs.push_back("독수리 오형제");

	for_each(vs.begin(),vs.end(),func);
}
728x90
반응형

'프로그래밍 기록 > stl' 카테고리의 다른 글

mstmatch  (0) 2023.12.09
equal  (0) 2023.12.09
search  (0) 2023.12.09
adjacent_find  (0) 2023.12.09
shuffle  (0) 2023.12.09

댓글