//  문제  가장 큰 값을 찾아라! (Find Max using Reference)
// 🧩 문제 설명
// 정수형 배열 arr 안에 있는 값 중에서 가장 큰 값을 찾아 maxVal에 저장하세요.
// 단, maxVal에 직접 대입하지 말고 레퍼런스 변수 ref를 사용해야 합니다.


#include <iostream>
using namespace std;

int main() {
    int arr[5] = {42, 15, 78, 33, 91};
    int maxVal = arr[0];

    // TODO: maxVal을 참조하는 ref를 사용하여 최대값 구하기

    cout << "최댓값: " << maxVal << endl;
    return 0;
}
// ✅ 조건
// int& ref = maxVal; 형식으로 참조 변수 선언

// ref만 사용해서 maxVal을 바꿔야 함 (maxVal = ... 직접 사용 금지)

// ✅ 예시 출력
// makefile

// 최댓값: 91

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: