check this piece of code out:
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)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; }
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