제출 #117248

#제출 시각아이디문제언어결과실행 시간메모리
117248maho04scanf 함수 2 (BSC_0_4)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
#include <string>
using namespace std;
int main(){
  string a;
  cin >> a;
  if(a.length()==1)
  {
    a.insert(0,"00");
    cout<<a;
  }
  else if(a.lenth()==2)
  {
    a.insert(0,"0");
    cout<<a;
  }
  else if(a.lenth()==3)
  {
    cout<<a;
  }
}

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

scanf2.cpp: In function 'int main()':
scanf2.cpp:12:13: error: 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}' has no member named 'lenth'; did you mean 'length'?
   else if(a.lenth()==2)
             ^~~~~
             length
scanf2.cpp:17:13: error: 'std::__cxx11::string {aka class std::__cxx11::basic_string<char>}' has no member named 'lenth'; did you mean 'length'?
   else if(a.lenth()==3)
             ^~~~~
             length