Guest User

Untitled

a guest
May 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. int Order::removeCakeByCakeNo(int a)
  2. {
  3.     for(int i=0;i<5;i++)//traverse array
  4.     {
  5.        
  6.         if(orderStatus==false)//if order not completed/not paid
  7.         {
  8.             if(listOfCakes[i]!=NULL)//if array is not empty
  9.             {
  10.                 if(listOfCakes[i]->getCakeNumber()==a)//if cake number = cake number provided by user
  11.                 {
  12.                 listOfCakes[i]=NULL;//store cake into order array
  13.                 //orderTotal = orderTotal + c->getCakeCost();//orderTotal initialised as 0.0, thus, need 0.0 + $cost of cake to get order total
  14.  
  15.                 return 1;
  16.                 }
  17.                
  18.             }  
  19.  
  20.  
  21.                    
  22.         }
  23.        
  24.     }
  25.     return -1;
  26. }
Add Comment
Please, Sign In to add comment