제출 #119241

#제출 시각아이디문제언어결과실행 시간메모리
119241ioilolcom크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
컴파일 에러
0 ms0 KiB

string ans="";
void Init() {
	ans="";
}



void Init() {
}
void TypeLetter(char L){
	ans+=L;
}
void UndoCommands(int m) {
	if(m>=(int)ans.size()) {
		ans="";
	}
	else{
		ans.erase((int)ans.size()-m,(int)ans.size()-1);
	}
}
char GetLetter(int P){
	return ans[P-1];
}

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

scrivener.cpp:2:1: error: 'string' does not name a type; did you mean 'struct'?
 string ans="";
 ^~~~~~
 struct
scrivener.cpp: In function 'void Init()':
scrivener.cpp:4:2: error: 'ans' was not declared in this scope
  ans="";
  ^~~
scrivener.cpp: In function 'void Init()':
scrivener.cpp:9:6: error: redefinition of 'void Init()'
 void Init() {
      ^~~~
scrivener.cpp:3:6: note: 'void Init()' previously defined here
 void Init() {
      ^~~~
scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:12:2: error: 'ans' was not declared in this scope
  ans+=L;
  ^~~
scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:15:13: error: 'ans' was not declared in this scope
  if(m>=(int)ans.size()) {
             ^~~
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:23:9: error: 'ans' was not declared in this scope
  return ans[P-1];
         ^~~