제출 #9249

#제출 시각아이디문제언어결과실행 시간메모리
9249dolpang2Veni, vidi, vici (kriii2_V)C++14
컴파일 에러
0 ms0 KiB
#include <cstdio>
#include <iostream>
#include <string>

int main() {
  int n = 0;

  scanf(" %d", &n);
  std::string word;
  while (std::cin >> word) {
    
    if (word.size() % 2 == 1) {
      word.pop_back();
    }
    std::string result;
    for (size_t i = 0; i < word.size(); i += 2) {
      char a = word[i] - 'a';
      char b = word[i + 1] - 'a';

      int c = (a + b - n) % 26;
      char d = c + 'a';
      result.push_back(d);
    }
    std::cout << result << " ";
  }
}

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

V.cpp: In function 'int main()':
V.cpp:13:12: error: 'std::string' has no member named 'pop_back'
V.cpp:8:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]