Take a look at the below code:-
if( strcmpi(e.ret_model() , mod )==0 )
{
cout<<"\n Original Price "<<e.ret_price();
cout<<"\n Enter new price " ;
cin>>price;
e.ret_price()==price; //logical error. How to overwrite data in a file?
cout<<"\n Price successfully changed to "<<e.ret_price();
}
e.retprice() is a function to return the price from a class. I want to change it to the 'price' which I'm asking for. How do we overwrite data in a file? if I have some data stored in a variable and I want to change it in a function where I open the file in fstream how do I do it The second last line would cause an ambiguity, right? I cannot change the data this way.
Any help is appreciated THANK YOU
Aucun commentaire:
Enregistrer un commentaire