투케이2K

34. (C++) max 사용해 입력 된 두 정수 값 중 최대 값 출력 실시 본문

C++

34. (C++) max 사용해 입력 된 두 정수 값 중 최대 값 출력 실시

투케이2K 2023. 3. 5. 11:52
반응형

[개발 환경 설정]

개발 언어 : C++

 

[소스 코드]

// -----------------------------------------------------------------------------------------
//
// Created by KGH on 2023-02-12.
//
// -----------------------------------------------------------------------------------------





// -----------------------------------------------------------------------------------------
// TODO [헤더 파일 import]

#include "Test.h"
#include <android/log.h>
// -----------------------------------------------------------------------------------------





// -----------------------------------------------------------------------------------------
// TODO [include 및 define 문 정의]
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
// -----------------------------------------------------------------------------------------





// -----------------------------------------------------------------------------------------
// TODO [구현부 소스 코드 작성]
int main(void)
{

    /**
     * ------------------------------------
     * [요약 설명]
     * ------------------------------------
     * 1. max : 입력된 두 값 중 최대값을 출력합니다
     * ------------------------------------
     * */


    // [변수 선언 실시]
    int one = max(1,1);
    int two = max(1,2);
    int three = max(3,2);


    // [로그 출력 실시]
    __android_log_print(ANDROID_LOG_WARN, "[C++] [LOG]", "%s", "=====================================================");
    __android_log_print(ANDROID_LOG_INFO, "[C++] [LOG]", "[one] :: %d", one);
    __android_log_print(ANDROID_LOG_INFO, "[C++] [LOG]", "[two] :: %d", two);
    __android_log_print(ANDROID_LOG_INFO, "[C++] [LOG]", "[three] :: %d", three);
    __android_log_print(ANDROID_LOG_WARN, "[C++] [LOG]", "%s", "=====================================================");


    return 0;
}
// --------------------------------------------------------------------------------------
 

[결과 출력]

 

W/[C++] [LOG]: =====================================================
I/[C++] [LOG]: [one] :: 1
I/[C++] [LOG]: [two] :: 2
I/[C++] [LOG]: [three] :: 3
W/[C++] [LOG]: =====================================================

 

반응형
Comments