← Back to List

5656번: 비교 연산자 ↗

Solutions

C++14
868 B | 868 chars
#include <bits/stdc++.h>
using namespace std;
int A,B,Cnt=1;
string a;
int main()
{
    while(1)
    {
        cin>>A>>a>>B;
        if(a=="E") return 0;
        cout<<"Case "<<Cnt<<": ";
        Cnt++;
        if(a==">")
        {
            if(A>B) cout<<"true";
            else cout<<"false";
        }
        if(a==">=")
        {
            if(A>=B) cout<<"true";
            else cout<<"false";
        }
        if(a=="<")
        {
            if(A<B) cout<<"true";
            else cout<<"false";
        }
        if(a=="<=")
        {
            if(A<=B) cout<<"true";
            else cout<<"false";
        }
        if(a=="==")
        {
            if(A==B) cout<<"true";
            else cout<<"false";
        }
        if(a=="!=")
        {
            if(A!=B) cout<<"true";
            else cout<<"false";
        }
        cout<<endl;
    }
}