Submission #2692752


Source Code Expand

#include <iostream>
#include <string>
using namespace std;
int main (){
  string X;
  cin >> X;
  if (X == 'A'){
    cout << 1 << endl;
  }
  else if (X == 'B'){
    cout << 2 << endl;
  }
  else if (X == 'C'){
    cout << 3 << endl;
  }
  else if (X == 'D'){
    cout << 4 << endl;
  }
  else if (X == 'E'){
    cout << 5 << endl;
  }
}

Submission Info

Submission Time
Task A - A
User Akihiko
Language C++14 (GCC 5.4.1)
Score 0
Code Size 358 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:7:9: error: no match for ‘operator==’ (operand types are ‘std::string {aka std::basic_string<char>}’ and ‘char’)
   if (X == '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:7:12: note:   ‘std::string {aka std::basic_string<char>}’ is not derived from ‘const std::fpos<_StateT>’
   if (X == 'A'){
            ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                 from /usr/include...