Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. void bookStock(int fAry[], int fAry2[], int* bkName)
  4. {
  5. for(int i = 0; i <5; i++)
  6. {
  7. if(fAry[i] == *bkName)
  8. {
  9. printf("There are %d this many books in stock: \n", fAry2[i]);
  10. }
  11. else if(fAry[i] != *bkName)
  12. {
  13. return;
  14. }
  15. }
  16. }
  17. int main(void)
  18. {
  19. int* bookName;
  20. int* address;
  21. int* bookArray[5] = {12345, 13245, 12346, 14567, 16789};
  22. int* quantityArray[5] = {1, 0 , 6, 4, 3};
  23. int* bookPrice[5] = {10, 25, 15, 20, 30};
  24.  
  25. printf("Please enter a book name(to see if we have it in stock): ");
  26. scanf("%d %d", bookName, address);
  27.  
  28. bookStock(bookArray, quantityArray, bookName);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement