Difference between revisions of "Accumulators For Searching Tutorial"

From Progzoo
Jump to: navigation, search
(The biggest population)
(The biggest population)
Line 45: Line 45:
 
<hint tease="How to use an accumulator">
 
<hint tease="How to use an accumulator">
 
Recall that there are three steps:
 
Recall that there are three steps:
*Declare and initialise your accumulator <i>before</i> the loop
+
*Declare and initialise your accumulator <i>before</i> the loop starts.
starts.
 
 
  int acc = 0;
 
  int acc = 0;
 
*Update the accumulator inside the loop if appropriate.
 
*Update the accumulator inside the loop if appropriate.

Revision as of 08:20, 22 July 2009

The biggest population

What is the population of the largest country (by population).

[Font] [Default] [Show] [Resize] [History] [Profile]

Which country has the biggest population?

What is the name of the largest country (by population).

[Font] [Default] [Show] [Resize] [History] [Profile]

Which middle eastern country has the smallest population?

What is the name of the country in region "Middle East" with the smallest population.

[Font] [Default] [Show] [Resize] [History] [Profile]