제출 #341792

#제출 시각아이디문제언어결과실행 시간메모리
341792marvenleeMemory (IOI10_memory)C++14
컴파일 에러
0 ms0 KiB
#include "grader.h"
#include "memory.h"
#include <map>

void play() {
   int i;
   char a, b;
   map<char,int> mp;
   for (i=1; i<=50; i++){

        a = faceup(i);
        if(mp.find(a)!=mp.end()){
            b = faceup(mp.find(a));
        }
        else {
            mp[a]=i;
            i+=1;
            b= faceup(i);
            mp[b]=i;
        }

   }

}

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

memory.cpp: In function 'void play()':
memory.cpp:8:4: error: 'map' was not declared in this scope; did you mean 'std::map'?
    8 |    map<char,int> mp;
      |    ^~~
      |    std::map
In file included from /usr/include/c++/9/map:61,
                 from memory.cpp:3:
/usr/include/c++/9/bits/stl_map.h:100:11: note: 'std::map' declared here
  100 |     class map
      |           ^~~
memory.cpp:8:8: error: expected primary-expression before 'char'
    8 |    map<char,int> mp;
      |        ^~~~
memory.cpp:12:12: error: 'mp' was not declared in this scope
   12 |         if(mp.find(a)!=mp.end()){
      |            ^~