제출 #1016352

#제출 시각아이디문제언어결과실행 시간메모리
1016352Faggi크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++11
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <stack> #include <string> using namespace std; vector<string> textHistory; stack<int> undoStack; void Init() { textHistory.clear(); undoStack = stack<int>(); textHistory.push_back(""); } void TypeLetter(char L) { string currentText = textHistory.back(); currentText.push_back(L); textHistory.push_back(currentText); } void UndoCommands(int U) { for (int i = 0; i < U; ++i) { undoStack.push(textHistory.size() - 1); textHistory.pop_back(); } char GetLetter(int P) { string currentText = textHistory.back(); return currentText[P]; }

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

scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:29:23: error: a function-definition is not allowed here before '{' token
   29 | char GetLetter(int P) {
      |                       ^
scrivener.cpp:32:1: error: expected '}' at end of input
   32 | }
      | ^
scrivener.cpp:23:26: note: to match this '{'
   23 | void UndoCommands(int U) {
      |                          ^