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

Looking for articles regarding the use of counters in a computer program. I've googled, yahoo searched, and asked jeeves and I'm at a loss.

2006-06-20 14:28:15 · 1 answers · asked by Jennifer 1 in Computers & Internet Programming & Design

1 answers

Which programming language do you want to create counters?

If you just want free counters, try http://www.statcounter.com/free_hit_counter.html

With every program, they differ on how its coded. With Java, you need to keep a session alive. There is a way to capture the user info when someone visits the page and its easily done in java since they have libraries that give a user a unique ID. Once they visit the page, we just increment the counter in the session.

Then I would say it would be in a "while loop" since the conventional "for loop" requires a maximum. But since there are no maximums in a counter, I would use the "while loop". While theres a visitor, increment the counter to +1.

counter = 0;
if user visits then you increase the counter to
counter = counter + 1;

When the counter is 1 then the counter will be set to 1+1 which is 2. When another visits, then the counter would become 2+1 which is 3. For each visitor, the previous set counter will be increased by itself +1. All programming codes usually use the same logic when it comes to dealing with counters.

2006-06-20 14:31:09 · answer #1 · answered by Sean I.T ? 7 · 0 0

fedest.com, questions and answers