본문 바로가기
c++/프로그래머스

[프로그래머스] 조건 문자열(c++)

by ilp 2023. 12. 27.
반응형

https://school.programmers.co.kr/learn/courses/30/lessons/181934

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr



#include <string>
#include <vector>

using namespace std;

int solution(string ineq, string eq, int n, int m) {
    if(ineq==">"&&eq=="="&&n>=m||ineq=="<"&&eq=="="&&n<=m||ineq=="<"&&eq=="!"&&n<m||ineq==">"&&eq=="!"&&n>m){
        return 1;
    }
    else{
        return 0;
    }

}

그냥 조건대로 하면 된다.

c++에선 &&은 and

||은 or

이다.

and &&
or ||

반응형