I'm just haven't figured out how to get to the specific Id when it is in the 2nd or 3rd row and save each individual part on that line to a certain variable.
There is a lot more to the project it just that this one part stops me from continuing.
Again I'm new to C++ so thanks for your comments and suggestions.
class item
{
public:
int amount, id;
string name;
double price;
};
istream& operator >> ( istream& is, item it )
{
is >> it.id >> it.name >> it.amount >> it.price; // order has to depend on how the file was written
return os;
}
int main()
{
item myitem;
ifstream file( "myfile" );
while( !file.eof() )
{
file >> myitem;
if ( myitem.id == the_id_you_want )
{
// your operations
}
}
}