답안 #869312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
869312 2023-11-04T02:54:03 Z sqrteipi Memory (IOI10_memory) C++14
컴파일 오류
0 ms 0 KB
#ifdef __cplusplus
extern "C" {
#endif
char faceup(int C);
void play();
#ifdef __cplusplus
}
#endif

// TODO: global variables can be declared here
int cards[25][2], a, b;
int i;

void play() {
  // TODO: implementation
  for(i=0; i<25; i++){
    cards[i][0] = 0;
    cards[i][1] = 0;
  }
  
  for(i=1; i<=50; i+=2){
    a = faceup(i)-65;
    b = faceup(i+1)-65;
    if (cards[a][0]==0){
      cards[a][0] = i;
    }
    else{
      cards[a][1] = i;
    }

    if (cards[b][0]==0){
      cards[b][0] = i+1;
    }
    else{
      cards[b][1] = i+1;
    }
  }

  for(i=0; i<25; i++){
    faceup(cards[i][0]);
    faceup(cards[i][1]);
  }
}

Compilation message

/usr/bin/ld: /tmp/cctwalCG.o: in function `main':
grader.cpp:(.text.startup+0x2f): undefined reference to `play()'
/usr/bin/ld: /tmp/ccxkObyG.o: in function `play':
memory.cpp:(.text+0x71): undefined reference to `faceup'
/usr/bin/ld: memory.cpp:(.text+0x8b): undefined reference to `faceup'
/usr/bin/ld: memory.cpp:(.text+0xe6): undefined reference to `faceup'
/usr/bin/ld: memory.cpp:(.text+0xf6): undefined reference to `faceup'
collect2: error: ld returned 1 exit status