如何判断一个字符串属于下面的集合?
char *attackType[][15]={{"normal"},
{"ip sweep","nmap","portsweep","satan","saint","mscan"},
{"back","land","neptune","pod","smurf","teardrop","apache2","mailbomb","udpstorm","processtable"},
{"perl","rootkit","loadmodule","buf_overflow","httptunned","ps","sqlttack","xterm"},
{"ftp-write","guess_passwd","multihop","phf","imap","spy","warezclient","waremaster","named","xsnoop","xlock","sendmail","worm","snmpgetattack","snmpguess"}};
C++最好使用容器类如STL,或MFC的CStringArray,这些查询算法已经都包含了;如果只是想了解如何实现可以自己写写,不过STL源代码和MFC的源代码都有了,你可以看看这些代码,设计工作中选择这些已有的实现和数据结构就行了
老大!
一个简单的办法是遍历数据。
或者可以看看这个数据对象有没相应的API来找?