답안 #19198

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19198 2016-02-20T03:21:51 Z anrhks1212 최댓값 (tutorial2) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
using namespace std;
int GetMax(int N, int *A);
int main()
{
	int N;
	cin >> N;
	int *A = new int[N - 1];
	int temp = GetMax(N, A);
	cout << temp;

    return 0;
}
int GetMax(int N, int *A)
{
	int i=0, max=0;

	for (i = 0; i<N; i++)
	{
		cin >> A[i];
	}

	max = A[0];
	for (i = 0; i < N - 1; i++)
	{
		if (max < A[i + 1])
		{
			max = A[i + 1];
		}
	}
	return max;
}

Compilation message

/tmp/ccppjwt6.o: In function `main':
tutorial2.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccyrk57d.o:grader.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status