Cashier Program C++
Cashier Program C++
h>
#include<time.h>
//simple chasier mechine program
main()
{
cout<<"press(0) to calculate total price\n";
q:
float price,total,payment,balance,quantity;
char date [9];
char time [9];
_strdate(date);
_strtime(time);
cout<<"The current date is "<<date<<endl;
cout<<"The current time is "<<time<<endl;
cout<<"\t .................................\n";
cout<<".........................................................\n";
cout<<":\t\tWelcome to Super Market\t\t\t:\n";
cout<<".........................................................\n";
cout<<"\t .................................\n";
quantity=0;
total =0;
do{
quantity=quantity+1;
cout<<"\t\tPrice for"<<quantity<<"item is : RM";
cin>>price;
total = total+price;}
while(price!=0);
cout<<"\t\tTotal Price\n"<<"\t_________________________________________\n";
cout<<"\t\t\tRM"<<total<<endl;
cout<<"\t_________________________________________"<<endl;
cout<<"\t\tCustomer payment RM";
cin>>payment;
balance=payment-total;
cout<<"\t\tBalance = RM"<<balance<<endl;
cout<<"\t\t\t~THANK YOU~"<<endl;
char y;
cout<<"Would you like to serve for the next customer?(y/n)";
cin>>y;
if (y == 'y'||y=='1')
{cout<<"*************************************************************\n"
;
cout<<"*************************************************************\n";
cout<<""<<endl;
goto q;}
else
{cout<<"\t\t**********************\n";
cout<<"\t\t* well done ^_^ *\n";
cout<<"\t\t*take a good rest ya~*\n";
cout<<"\t\t**********************"<<endl;
return 0;}
}