mercredi 25 mars 2015

Figuring out if statement

So my project is about creating a table that adds statistic comparisons to a selection sort table. I've done the bulk of the work but am stuck at this one part that asks me to It should add "comparisons" to "totalComparisons". It should compare "comparisons" to "minComparisons" and set "minComparisons" to whichever is smaller. It should also set "maxComparisons" in an analogous fashion. The words in quotes are variables. I know I need to write an if statement but I have no idea how to write it. Can somebody show me how to do the part where you compare "comparisons" to "minComparisons" and set "minComparisons" to whichever is smaller.


My code so far:



private static void endStatistics(){
totalComparisons += comparisons;
if (comparisons ){

}


thanks for any help.


Aucun commentaire:

Enregistrer un commentaire