我有一个小结构:
struct price
{
char name[20];
char shop[20];
int pr;
price *next;
};
一个不起作用的功能:
void show_info(price *&head, char cur)
{
bool found = 0;
price *temp = new price;
temp->name = cur;
for (price *i=head; i!=NULL; i=i->next)
if (temp == i)
{
cout<< i->shop << i->pr;
found = 1;
}
if (!found)
cout << "The the good with such name is not found";
delete temp;
}
一个主文件:
int main()
{
price *price_list=NULL;
char inf[20];
list_fill(price_list);
cout << "Info about goods: ";
show_list(price_list); //there is no problem
cout <<"Input goods name you want to know about: ";
cin >> inf;
cout << "The info about good " << inf << show_info(price_list,inf)<<endl;
system("pause");
return 0;
}
我需要修复我的功能,以便它可以正常工作。
如前所述,错误是c2664。