I have this error in my code. Can anyone figure out what's the problem ?
Error E2188 workingArea2.cpp 57: Expression syntax in function CRectangle::check()
Code:
#include <iostream>
using namespace std;
// declaring a class
class CRectangle
{
public:
void set_values(int, string);
string check();
string check2();
private:
int x,flag,counter;
string y;
size_t found,found1,found2,found3,found4,found5,found6,found7,found8,found9,found10,found11;
};
void CRectangle::set_values (int a, string b)
{
x = a;
y = b;
}
// test three conditions
string CRectangle::check()
{
found = y.find('4');
found1 = y.find('5');
found2 = y.find('8');
found3 = y.find('9');
found4 = y.find('A');
found5 = y.find('L');
found6 = y.find('P');
found7 = y.find('R');
found8 = y.find('T');
found9 = y.find('V');
found10 = y.find('W');
found11 = y.find('X');
flag =0;
counter=0;
if(x != 6)
{
cout << "false"<< endl;
}
else if ((found==string::npos)||(found1==string::npos))
cout << "NOOO! please"<<endl;
else if ((found2==string::npos)&&(found3==string::npos))
cout << "NOOO! please" << endl;
else
while(counter<4)
{
if (found4==string::npos)||(found5==string::npos)||found6==string::npos)||(found7==string::npos)||found8==string::npos)||(found9==string::npos)||found10==string::npos)||(found11==string::npos))
{
flag=1;
cout << "good"<<endl;
break;
}
counter++;
}
return y;
}
int main () {
int length;
string codeNumber;
string mystr = codeNumber;
cout << "Insert a code of 6 characters:";
cin >> codeNumber;
length = codeNumber.length();
CRectangle rect;
rect.set_values (length,codeNumber);
rect.check();
return 0;
}