본문 바로가기
개인공부/Algorithm(C, C++)

SW Expert Academy (2070. 큰 놈, 작은 놈, 같은 놈)C++

by 저세상판단 2021. 8. 9.
반응형

#include<iostream>
#include<stdio.h>

using namespace std;

int main(int argc, char** argv)
{
int test_case;
int T;
    int a, b;

cin>>T;

for(test_case = 1; test_case <= T; ++test_case)
{
        a = 0;
        b = 0;
scanf("%d %d", &a, &b);
        if( a > b)
            printf("#%d >\n", test_case);
        else if( a == b)
            printf("#%d =\n", test_case);
        else
            printf("#%d <\n", test_case);
       
            
}
return 0;//정상종료시 반드시 0을 리턴해야합니다.
}

 

 

1. 같다를 비교할떈 등호 두 개...

2. 문자열로 기본으로 하나 설정 후 char res = '=' 다른 두 조건( > , <) 일 때 res를 변경 하는 방식도 있다.

반응형