Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <string>
  2. #include <vector>
  3. #include <iostream>
  4. #include<cstdio>
  5. #include<algorithm>
  6. using namespace std;
  7.  
  8. string solution(vector<string> seoul) {
  9. string answer = "";
  10. int a;
  11. for(int i=0;i<seoul.size();i++){
  12. if(seoul[i]=="Kim") a=i;
  13. }
  14. answer="김서방은 ";
  15. answer.append(to_string(a)); //int형을 string으로 바꿀때는 to_string()
  16. answer.append("에 있다"); //string에 string을 덧붙일 때는 append 사용.
  17. return answer; //string에 맨뒤에 char 하나를 붙이고 뗄 때에만 push_back,pop_back사용.
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement