제출 #148357

#제출 시각아이디문제언어결과실행 시간메모리
148357sg1774최댓값 (tutorial2)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; GetMax(int n, int a[200]) { scanf("%d",&n); for(int i=0;i<z;i++) scanf("%d",&a[i]); int s=0; for(int i=0;i<n;i++) s=max(s,a[i]); printf("%d",s); return 0; }

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

tutorial2.cpp:3:25: error: ISO C++ forbids declaration of 'GetMax' with no type [-fpermissive]
 GetMax(int n, int a[200])
                         ^
tutorial2.cpp: In function 'int GetMax(int, int*)':
tutorial2.cpp:6:19: error: 'z' was not declared in this scope
     for(int i=0;i<z;i++) scanf("%d",&a[i]);
                   ^
tutorial2.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
tutorial2.cpp:6:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<z;i++) scanf("%d",&a[i]);
                          ~~~~~^~~~~~~~~~~~