Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define max 15
  4.  
  5. int lineal(char elementos[], char elebus)
  6. {
  7. int i = 0;
  8. for(i=0; i<max; i++)
  9. {
  10. if(strcmp(elementos[i], elebus)==0)
  11. {
  12. printf("Elemento encontrado en %d,", i); //element found in
  13. }
  14. else
  15. {
  16. printf("elemento no encontrado"); //not found
  17. }
  18. }
  19.  
  20. }
  21.  
  22. int main()
  23. {
  24. char elebus[50];
  25. char elementos[max][50]= {"Panque", "Pastel", "Gelatina", "Leche", "Totis", "Tamarindo" "Papas", "Duraznos", "Cacahuates", "Flan", "Pan", "Yogurt", "Café", "Donas", "Waffles"};
  26. printf("Escribir elemento a buscarn");
  27. scanf("%s", elebus);
  28.  
  29. int lineal(char elementos[], char elebus);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement