I am trying to compare two arrays and see how many are same and in same position. Also, see how many are same but in not same position. I dont know why but my code always gives 1 for right and 3 for wrongplace.
I guess line 23 is used to exit the loop? Use break; instead.
Also how do you check that it's in the right place or not? You don't check indexes of your arrays.
You should check each element of the first with each element of the other and if you find a match just compare their indexes. That way if it matches you have a rightplace otherwise you have a wrongplace.
Also you don't initialize comparing besides the first 4 elements and 9-13. Don't do that. I think it's platform dependent if it's being initialized but never assume that. Force initialization yourself.
the code was only created here. I did not give my actual code because I might have a lot of unnecessary stuff lol
So,
I taking input of 4 numbers from the user 10 times. line represents line.
I want to reply to the user howmany he has got right and in ecxact position and how many he has got right but in wrong position.
I expect 1 for right and 2 for wrongplace.
btw now.
the first time it gives 0,0 and all other times 2, 2; i dont know what it is.