Click here to Skip to main content
15,878,970 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
to delete a book in a function of buying after the book is bought so that it can be removed from the list of books available

What I have tried:

<pre lang="C#">
Posted
Updated 3-Dec-22 13:19pm

We can't help you, partly because nobody deletes books from a collection when it's bought in the real world - they set the stoick level down one each time a book is sold. When the stock level reaches zero, there are none in stock.
That way, when a delivery comes in, you just add the delivered quantity to the stock level and you are good to go.

But mostly because we have no idea what you code looks like, how it works, what you are storing, and how you are storing it - and even in an ancient language like C there is no "one right way" to store a collection of books!

Start by looking at how you store your data at the moment, and how you add an item to that collection. Deletion is likely to be the reverse of that process!
 
Share this answer
 
Quote:
How to delete a book in a List

You write that you have a list of available books and want to remove one of them when it is sold. One of the few useful ways to program a list with this function in C would be a chained list. Without you showing your code so far and describing where exactly the problem is, we won't get anywhere.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900