TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Geo
from: Mike N.
date: 2004-11-11 22:53:50
subject: Re: C++

From: Mike N. 

On Thu, 11 Nov 2004 18:35:42 -0600, "Geo"  wrote:

>I want a 2 dimensional array where each element contains a string value. I'm
>trying to write a statistics program that reads in a log file then
>calculates stats. But most of the log file is email addresses, IP addresses,
>domain names, etc.

  One interesting approach to this is to use a type of container called a
'map'.   (Without trying to validate this; beware) Basically,

  // Declare associative array named 'senderCount' of template type map
keyed by string containing int values
  map senderCount;

  string email;

You can manipulate the values like this:
 senderCount[email]=0;
 senderCount[email]++;

   o  The senderCount data is sorted
   o  You don't have to linearly search an array to update the random
string values coming from the log file (much faster).

 [It's left as an exercise how to detect whether to increment an existing
map value or initialize a new value to zero]


  Microsoft heathens can also use CMap, which is documented better in the
MSDN.   If you use STL (recommended), plan on using supplemental reference
materials.

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.