这是我的代码,用于在链接列表中搜索,但它不会给我正确的结果。请帮助我,我很担心它。在链接列表中搜索
search() {
char ser[20];
cout << "enter data to be searched" << endl;
gets(ser);
for (start=head; start->ptr!=NULL; start=start->ptr) {
if (start->info == ser) {
cout << "ok" << endl;
break;
}
}
cout << "not found" << endl;
}
感谢, 赛马坎瓦尔Bhutta
很难说gets()是正确的。 – 2011-04-30 08:37:59