제출 #3155

#제출 시각아이디문제언어결과실행 시간메모리
3155chan492811최댓값 (tutorial2)C++98
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <cstdio>
using namespace std;
int n,s,m;
void gm(int q,int w)
{
    if(q>=w)m=q;
    else m=w;
    return;
}
int main()
{
	int i;
	scanf("%d",&n);
	scanf("%d",&s);
	m=s;
	for(i=2;i<=n;i++)
	{
	    scanf("%d",&s);
	    gm(m,s);
	}
	printf("%d",m);
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

tutorial2.cpp: In function 'int main()':
tutorial2.cpp:14:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
tutorial2.cpp:15:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
tutorial2.cpp:19:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
/tmp/ccErea2A.o: In function `main':
tutorial2.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccS6a9XO.o:grader.cpp:(.text.startup+0x0): first defined here
/tmp/ccS6a9XO.o: In function `main':
grader.cpp:(.text.startup+0x97): undefined reference to `GetMax(int, int*)'
collect2: ld returned 1 exit status