프로그래머스 120883 로그인 성공?

Jmnote (토론 | 기여)님의 2023년 11월 27일 (월) 19:41 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

프로그래머스 120883 로그인 성공?

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

string solution(vector<string> id_pw, vector<vector<string>> db) {
    string id = id_pw[0];
    string pw = id_pw[1];
    for(auto& row: db) {
        if(row[0] != id) {
            continue;
        }
        if(row[1] == pw) {
            return "login";
        } else {
            return "wrong pw";
        }
    }
    return "fail";
}