Submission #4313472


Source Code Expand

#include <iostream>
using namespace std;

int main(){
  string s;
  sin >> s;
  
  if(s == 'a'){
    cout << -1 << endl;
  }else{
    cout << 'a' << endl;
  }
}

Submission Info

Submission Time
Task B - 辞書式順序
User kenta0000
Language C++14 (GCC 5.4.1)
Score 0
Code Size 172 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:6:3: error: ‘sin’ was not declared in this scope
   sin >> s;
   ^
./Main.cpp:8:8: error: no match for ‘operator==’ (operand types are ‘std::string {aka std::basic_string<char>}’ and ‘char’)
   if(s == 'a'){
        ^
In file included from /usr/include/c++/5/iosfwd:40:0,
                 from /usr/include/c++/5/ios:38,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/postypes.h:216:5: note: candidate: template<class _StateT> bool std::operator==(const std::fpos<_StateT>&, const std::fpos<_StateT>&)
     operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
     ^
/usr/include/c++/5/bits/postypes.h:216:5: note:   template argument deduction/substitution failed:
./Main.cpp:8:11: note:   ‘std::string {aka std::basic_string<char>}’ is not derived from ‘const std::fpos<_StateT>’
   if(s == 'a'){
           ^
In file included from /usr...