English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Lets say you are doing a count on people in the different categories of their district. Districts are from 1 to 22. How would you code it (VB). I know you have to set array to 0, but when counting the people in each group, what statement would be needed. take for instance: num cenDistrict, num citizen
num count[23] all =0
mainloop()
count[district] = count[district] + 1 I am hoping this statement is counting the districts

finishup()

count = 1
while count <=22 then
print count, count[district]
count = count + 1

My question: am I counting citizens in any of these statements

2007-03-14 20:04:05 · 1 answers · asked by Anastacia 2 in Computers & Internet Programming & Design

1 answers

You seem to be having some confusion.
Your array is count[]
and should be incremented as you have it.
count[district] = count[district] + 1
This statement will count citizens.
You already have the total count of districts at 22.
If you want to know how many districts there are then count the number of non zero elements in the array count.

You then have another count
ie
count = 1
This is an illegal use of a variable as it is already defined as an array. Change the name of this variable.

2007-03-15 05:30:02 · answer #1 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers