Counting Comparisons in a Program. Use a global counter to keep track of the number of comparisons. It is important to make sure that the counter increments at each comparison, regardless of the outcome of the comparison. Initializing your counter, a global variable: int kounter = 0; // initialize a global variable Defining the function "lessfloat," which you use instead of "<" in your code. bool lessfloat(float x,float y){ kounter++; // kounter is a global variable if (x < y) return true; else return false; } Using the function "lessfloat": if (lessfloat(A[i],A[j])) // kounter is incremented // whatever statement you want here else // whatever statement you want here What if you want to use "lessfloat" when the comparison isn't "<"? No problem. Replace (A[i] > A[j]) by (lessfloat(A[j],A[i])) Replace (A[i] <= A[j]) by (not lessfloat(A[j],A[i])) Replace (A[i] >= A[j]) by (not lessfloat(A[i],A[j])) Finally, at the end of the run, you output the value of the counter: cout << kounter; // the number of comparisions For each run, you must reinitialize the counter: kounter = 0; Some students are confused by the use of "lessfloat." You can also count the comparisons the pedestrian way. For example. {kounter++; if (A[i] < A[j]) // whatever statement you want here else // whatever statement you want here } This method is, however, more dangerous, since you must be careful to increment the counter exactly once for each comparison, and it is easy to make a mistake. I suggest you get over your mpoulophobia (fear of Booleans) and learn how to use "lessfloat." Report bugs to me (Dr. Larmore) immediately.