-
counters..omg :S
check this piece of code out:
Code:
for(int u=1;u<=5;u++){
inta=(a+(u-1)*f);
intb=a+u*f;
for(int r=0;r<n;r++)
if(w[r]>=inta && w[r]<=intb)
count++;
cout << "\t("<<inta<<","<<intb<<") " << count<<endl;
}
ive always sucked using multiple for's, but what i wanna do is count the number of times w[r] appears in the given (inta,intb) interval while u is 1,2,...5, individually (as in how many for 1, how many for 2, and so on)
but what i have here adds 1 to count for all u's.
so when i run the proggy i end up with count being 20, while in reality it should be a lot less :S
any thoughts? thx :)
-
ok nevermind, fixed it :)
i knew it had to be something stupid, i just initialized the counter to 0 after the cout :D
WOOT me so happy - proyect is done :D D:D :D: D:D:D
thx to all 8)
Code:
//kinda got excited there :P