what am i doing wrong
Nov 3, 2017 at 5:23pm UTC
The value of price and number of items comes to be 0 when reading file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
class cart
{
private :
char items[80];
int no=0;
float price=0;
public :
void getdata()
{
category(items,no,price);
ofstream w1;
w1.open("file.dat" );
w1<<"Total price=" <<price<<"\n" ;
w1<<"Total items=" <<no<<"\n" ;
w1.close();
}
void outdata()
{
cout<<"\n\nProceeding to checkout" <<endl;
}
};
Last edited on Nov 3, 2017 at 5:24pm UTC
Nov 3, 2017 at 5:29pm UTC
we can't see anything.
price is set to zero. no is set to zero. If you write them out, you will get 0 and 0. If you changed these values, we can't see this.
Topic archived. No new replies allowed.