my professor ask me to create a program on which i can display all the details of the book from book inventory that i recently made. But the hardest part is, i have to ask the user on how she/he wants to see the output, by title, by price, or by quantity.. meaning i have to use search kind of thing, to create a program.. help please i dont know how to do this
You can Use "if else if" loop for this purpose. for example,
if(choice==1) then write in peranthesis the output displaying title and respective details.else if(choice==2) then you can display the output by price and respective details,etc.
Display a menu of options, then use a switch to process the user choice. Have each case clause call a function to do that particular task. Don't forget to use a break at the end of each clause, and put in a default clause to catch bad input. This is better than using lots of else if conditions. One would only do this if the variable involved was not a constant integer or char.
Have a look in the reference section, top left of this page.