Page 456 - C++
P. 456

for(int i=0;name[i][0]!='\0'&&code[i]!=temp&&i<no;i++);
                                      if(code[i]==temp)
                                         {cout<<"\n Enter the new price for the item:Rs. ";
                                          cin>>price[i];
                                          cout<<"\n\t\t\t Price changed sucessfully!";}
                                   else
                                       cout<<"\n\n\t\t\t\a Code not found!";
                                   cout<<"\n\n\tDo you want to change price of another
                item?(press y/any other key):";
                                   choice1=getch();}while(choice1=='y'||choice1=='Y');
                                   break;
                          case '3': int j;
                                   char choice2;
                                   do{clrscr();
                                   cout<<"\n\t\t\tChange code!\n\n Enter the code you want
                to change:";
                                   cin>>temp;
                                   for(int i=0;name[i][0]!='\0'&&code[i]!=temp&&i<no;i++);
                                      if(code[i]==temp)
                                         {cout<<"\n Enter the new code:";
                                          cin>>temp;
                                          for(j=0;name[j][0]!='\0'&&code[j]!=temp;j++);
                                          if(code[j]==temp)
                                            {cout<<"\n\a\t The given new code already
                exists!\n\n\t Try again?(Press y/any other key):";
                                             choice1=getch();
                                             continue;}
                                          code[i]=temp;
                                          cout<<"\n\t\t\t Code changed sucessfully!";}
                                   else
                                       cout<<"\n\t\t\t\a Code not found!";
                                   cout<<"\n\n\tDo you want to change code of another
                item?(press y/any other key):";
                                   choice1=getch();}while(choice1=='y'||choice1=='Y');
                                   break;
                          case '4':break;
                          default : cout<<"\n\n\t\t\a Invalid choice! Enter again";
                                   getch();
                         }}while(choice!='4');
                cout<<"\n\n\t\t Going to item's screen...";
                getch();
                }


                       //Fn for deleting inventory
                void item::del()
                {int temp;
                char choice;
                do{clrscr();
                   cout<<"\n\t\t\tDelete!\n\n Enter the code you want to delete:";
                   cin>>temp;
                   for(int i=0;name[i][0]!='\0'&&code[i]!=temp&&i<no;i++);
                   if(code[i]==temp)
                     {for(;i<no&&name[i+1][0]!='\0';i++)
   451   452   453   454   455   456   457   458   459   460   461