답안 #145768

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
145768 2019-08-21T06:49:33 Z leewj1025 최댓값 (tutorial2) C++14
컴파일 오류
0 ms 0 KB
#include<stdio.h>

int main(){
	int n;
	int max = 0;
	int a[1000];
	scanf("%d",&n);
	for (int i = 0; i<n; i++){
		scanf("%d", &a[i]);
		if (max<a[i])
			max = a[i];
	}
	printf("%d", max);
}

Compilation message

tutorial2.cpp: In function 'int main()':
tutorial2.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
tutorial2.cpp:9:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
   ~~~~~^~~~~~~~~~~~~
/tmp/ccpsaVJN.o: In function `main':
tutorial2.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccsrBgfj.o:grader.cpp:(.text.startup+0x0): first defined here
/tmp/ccsrBgfj.o: In function `main':
grader.cpp:(.text.startup+0x97): undefined reference to `GetMax(int, int*)'
collect2: error: ld returned 1 exit status