답안 #16786

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16786 2015-09-29T04:39:23 Z kdh9949 카드 (GA8_card) C++
컴파일 오류
0 ms 0 KB
#include<stdio.h>

int k,m,n,sum;

int main()
{
  scanf("%d",&n);
  for(int i=0;i<n;i++){
  	scanf("%d",&k);
    m=m<k?k:m;
    s+=k;
  }
  printf("%d",s-m);
}

Compilation message

card.cpp: In function ‘int main()’:
card.cpp:11:5: error: ‘s’ was not declared in this scope
     s+=k;
     ^
card.cpp:13:15: error: ‘s’ was not declared in this scope
   printf("%d",s-m);
               ^
card.cpp:7:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
                 ^
card.cpp:9:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&k);
                  ^