首页 新闻 会员 周边 捐助

字符串与集合

0
悬赏园豆:15 [已解决问题] 解决于 2011-11-22 08:20

如何判断一个字符串属于下面的集合?

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"}};

ttssrs的主页 ttssrs | 初学一级 | 园豆:82
提问于:2011-03-19 13:35
< >
分享
最佳答案
0

C++最好使用容器类如STL,或MFC的CStringArray,这些查询算法已经都包含了;如果只是想了解如何实现可以自己写写,不过STL源代码和MFC的源代码都有了,你可以看看这些代码,设计工作中选择这些已有的实现和数据结构就行了

收获园豆:10
2012 | 高人七级 |园豆:21645 | 2011-03-19 22:02
其他回答(1)
0

老大!

一个简单的办法是遍历数据。

或者可以看看这个数据对象有没相应的API来找?

收获园豆:5
sunshaozong | 园豆:325 (菜鸟二级) | 2011-03-19 18:24
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册