Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <vector>
- #include <iostream>
- #include<cstdio>
- #include<algorithm>
- using namespace std;
- string solution(vector<string> seoul) {
- string answer = "";
- int a;
- for(int i=0;i<seoul.size();i++){
- if(seoul[i]=="Kim") a=i;
- }
- answer="김서방은 ";
- answer.append(to_string(a)); //int형을 string으로 바꿀때는 to_string()
- answer.append("에 있다"); //string에 string을 덧붙일 때는 append 사용.
- return answer; //string에 맨뒤에 char 하나를 붙이고 뗄 때에만 push_back,pop_back사용.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement