<= Minor or Equal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
int findWord(char ma[][iSize], char ca[],int iRing,int& X, int& Y){
	int ring=0,i=0,j=0,x=0,y=0,k=0,i2p=0,
		iLSide=0,iSSide=0;
	bool bOkay=true, bOver=false;
	ring = iRing--;
	iLSide=(iSize-(ring*2));
	iSSide=(iSize-((ring*2)+3));
	i2p=(iLSide*2)+(iSSide*2);
	x=y=i=ring;
	while(i>=ring && i<i2p && bOver==false){
		j=i;
		switch(i){
			case =< iLSide:
				x=ring;
				y=j;
				break;				
			case =<((iLSide*2)-1):
				j-=i;
				y=iLSide;
				x=j;
				break;
			case <=((iLSide*2)-2):
				j-=(iLSide*2)-2;
				x=iLSide;
				y=j;
				break;
			case <=((iLSide*2)-3):
				j-=(iLSide*2)-2;
				y=ring;
				x=j;
				break;
		}
		if(ma[x][y]==ca[k]){
			if(k==0){
				X=x;
				Y=y;}
			else if(k==(sizeof(ca)/sizeof(ca[0])))
				bOver=true;
			k++;
		}
		else
			k=0;			
	}										
}

I posted all the code just to let you see it if you need it. If makes a ring in a matrix and search a word. All made with char.

So the problem is
error C2059: syntax error :
If I write case =<
And
error C2059: syntax error : '<='
If I write case <=

How should I do it? THank you.
The cases have to be a constant expression.

For example,

1
2
3
4
5
6
7
8
9
10
switch(i)
{

case 1: // something
           break;
case 2: // something else
           break;
...
...
}


http://www.cplusplus.com/doc/tutorial/control/
Last edited on
Topic archived. No new replies allowed.