hi, i'm trying to find a product using .find(), but it doesn't work :-(
Code:void grocery::findProduct() { string id; cout<<"Product ID: "; cin>>id; set <product>::const_iterator it; if( Prod.find(id) == Prod.end() ) //set <product> Prod; is inside the grocery.h cout<<"not found\n"; else cout<<"\nthe product type is: "<<it->getType() <<"\n"; system("pause"); }
i know the product was inserted because after insertion, i view all products to be certain.
can anyone tel me what i'm doing wrong?