pls help me. i have got a school project to make a program that generates a shopping bill and shows the present stock at end of bill.
also
1.the user inputs only the quantity and product code(thats where i am facing problem to feed the product codes in my program and then link them with product names)
2.also i want some special offers to be given to customers(but first i will complete step one and then go for the second)
this is my program which is presently incomplete and wrong too:
#include<conio.h>
#include<iostream.h>
class product
{public:
int code,amnt;
float rate,price;
price=rate*amnt;
char name[10];
};
class stock:public product
{public:
};
main()
{int i=1;
float bill=0;
product.shop[15];
stock.mystock[15];
char c='y';
while(c=='y')
{bill=0;
cout<<"WELCOME TO CHITKARA SUPERMART :\nThe present stock is: \n";
for(i=1;i<=15;i++)
{cout<<"enter product code:";
cin>>shop[i].code;
cout<<" enter quantity: ";
cin>>shop[i].amnt;
switch(shop[i].code)
{case 1: shop[i].name="lays";
mystock[i].amnt--;
mystock[i].name= "lays";
shop[i].price=20;
break;
case 2: shop[i].name="soap";
mystock[i].amnt--;
mystock[i].name= "soap";
shop[i].price=40;
}
}
cout<<"your bill is:\nproduct\tamount\trate\tprice\n"<<shop[i].name<<"\n"<<shop[i].name<<"\t"<<shop[i].amnt<<"\t"<<shop[i].price;
}
cout<<"\"THANK YOU !\" PLEASE VISIT AGAIN !";
getch();
}