The mini-supermarket already has a list of product names and their corresponding
type (soap, oil, milk, cheese, etc….) included in it initially.
The user menu displays the following operations:
(Hint: Use the function gets to read an array of characters including spaces)
- Insert a product (name, type)
- Display products of (selected) type, i.e. the user select a type and display all
products’ names in this type
- Search product by name (if exist, display its name, and its type)“linear search
- display all products, their names and corresponding type, as they had enterd.

Recommended Answers

And your question is? PLEASE DO NOT ask us to do your homework for you. See the TOS (Terms of Service/Use) for this site. Make an effort, and we can help you fix errors, but you still have to do the work!

Jump to Post

All 4 Replies

And your question is? PLEASE DO NOT ask us to do your homework for you. See the TOS (Terms of Service/Use) for this site. Make an effort, and we can help you fix errors, but you still have to do the work!

Member Avatar

Are you asking if we can come up with working code that covers all the points in your provided specifications?

Yes, we can.

Just not for you.

(Hint: Use the function gets

Fire that teacher! gets() is a horrible function, allows buffer overflow, stack corruption, and possibly crash the whole program. Use fgets() instead of gets() to limit input to the max size of the buffer. fgets() has a couple quirks too, but they can be easily delt with.

spend less time worrying about your avatar, and you'll have more time to do your own work and not have to resort to cheating.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.