C++ program to solve grocery shop related question

Assume that you are visiting a grocery shop. You have a card that you use to shop and the credit limit for this card is Rs. 500. There are only two items (Item1 & Item2) that you can buy in a store costing Rs 40.00 and Rs 100.00 respectively. Shopping is only permissible up to card limit which means you could go on picking either Items 1 or 2 until the total price reaches the card limit or you choose to stop buying. You can also choose to buy only Item1 or Item2 up to total price equal to card limit. Design the complete logic to implement the above scenario in order to calculate the total price based on items picked. Display the items picked and the total price

Can anyone solve it. It is very important for me