help me stuck on this code

May 23, 2013 at 4:41am
I have narrowed it down to something is wrong with this piece of code here. can someone see something that I am doing wrong that I am not seeing ?

1
2
3
4
5
6
7
8
9
10
11
12
  if(rank[0] != 13)
		return 0;
	if(rank[1] != 12)
		return 0;
	if(rank[2] != 11)
		return 0;
	if(rank[3] != 10)
		return 0;
	if(rank[4] != 1)
		return 0;
	
		return 1;
May 23, 2013 at 4:43am
You forgot else statements.
May 23, 2013 at 4:44am
Impossible for us to know with that little bit of code....and we don't even know what exactly is wrong. Please post more code. Only thing I can think of is you are accessing wrong parts of the rank array or the values they are not equal to are wrong?

[edit]
(ispils post wasn't up when I responded origonally
@Ispil technically he wouldn't need the else because he has it return 1 at the end. So if it is not any of those things then it returns 1 automatically.

After looking at the code again though
maybe it should be
if( rank[0] != 13 && rank[1] != 12 && rank[2] != 11 && rank[3] != 10 && rank[4] != 1 ) return( 0 );
Last edited on May 23, 2013 at 4:48am
May 23, 2013 at 4:58am
Well, it would benefit from some else statements, just for clarity. Albeit we have no idea what the code is doing in the first place, so...
Topic archived. No new replies allowed.