What is the meaning of error shown below?
error: no match for 'operator==' (operand types are 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}')
This is the code I currently have:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i , pos1=0 , pos2=0 ;
string trump,card1,card2;
cin>>trump>>card1>>card2;
string a = "6789TJQKA";
if(trump == card1[1])
{
cout<<"YES";
return 0;
}
for(i=0;i<a.length();++i)
{
if(a[i] == card1[0])
pos1 = i;
if(a[i] == card2[0])
pos2 = i;
}
if(card1[1] == card2[1])
{
if(pos1>pos2)
cout<<"YES";
else
cout<<"NO";
return 0;
}
else if(card1[1]!=card2[1])
cout<<"NO";
return 0;
}
Aucun commentaire:
Enregistrer un commentaire