Page 459 - C++
P. 459

switch(choice1)
                               {case '1': ofstream printer;
                                          printer.open("PRN");
                                          printer<<"\n\t\t\t\t\b***************\n\t\t\t\t\b*
                ABC SWEETS *\n\t\t\t\t\b***************\n\n\t\tShop no. 66, Vasant
                Kunj\n\t\tPh: 4040031, 32, 38, 39";
                                          printer<<"\n\n Code\t\tName\t\tPcs.\tCost per
                unit\tTotal price";
                                          for(i=0;name[i][0]!='\0';i++)
                                             {if(quant[i])
                                                {printer<<"\n\n"<<code[i]<<"\t";
                                                 printer.width(16);
                                                 printer<<name[i]<<"\t";
                                                 printer<<quant[i]<<"\t
                "<<price[i]<<"\t\t"<<quant[i]*price[i];}
                                             }
                                          printer<<"\n\n\t\t\t\t\t\t\tTax=
                "<<tax(amount)<<"\n\n\t\t\t\t\t\t\tVAT= "<<vat(amount);
                                          printer<<"\n\n\t\t\t\t\t\t\tTotal= "<<amount;
                                          printer<<"\n\n\t\t\t Have a nice day!";
                                          for(i=0;name[i][0]!='\0';i++)
                                             quant[i]=0;
                                          printer.close();
                                          getch();
                                          break;
                               case '2': break;
                               default : cout<<"\n\n\t\t\t\a Wrong choice! Enter again";
                                         getch();}}while(choice1!='1'&&choice1!='2');
                 case '4': cout<<"\n\n\t\t\tExiting...";
                          getch();
                          break;
                 default : cout<<"\n\n\t\t\aWrong choice! Enter again";
                          getch();
                          break;}}while(choice!='4');
                }

                       //Fn for changing password
                void item::change()
                {char pass[25];
                 do{clrscr();
                    cout<<"\n\t\t\t Change password!\n\n Enter the new password:\n\n";
                    for(int j=0;;j++)
                       {word[j]=getch();
                       if(word[j]=='\b')
                         {j-=2;
                          cout<<"\b \b";}
                       else if(word[j]=='\r')
                              break;
                       else
                        {if(j==25)
                            {j--;
                             cout<<"\b*";}
                          else
                              cout<<"*";}
   454   455   456   457   458   459   460   461   462   463   464