Advertisement
GedsonJunior

pesquisa

Nov 24th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. void pesquisarCliente()
  2. {
  3. system("cls");
  4. char temp[50];
  5. char tempIdade[50];
  6. char tempSalario[50];
  7. char pesquisa[50];
  8. printf("________________________________________________________________________________");
  9. printf("\nDigite o nome do cliente: ");
  10. fflush(stdin);
  11. gets(pesquisa);
  12. FILE *f;
  13. f=fopen("banco.txt","r");
  14. while(fscanf(f,"%s",temp)!=EOF)
  15. {
  16. if(strcmp(temp,pesquisa)==0)
  17. {
  18. printf("\nCliente encontrado!\n\n");
  19. printf("\nNome %s",temp);
  20. fscanf(f,"%s",tempIdade);
  21. printf("\nIdade: %s",tempIdade);
  22. fscanf(f,"%s",temp);
  23. printf("\nSexo: %s",temp);
  24. fscanf(f,"%s",tempSalario);
  25. printf("\nSalario: %s",tempSalario);
  26. fscanf(f,"%s",temp);
  27. printf("\nDepartamento: %s\n\n",temp);
  28. system("pause");
  29.  
  30. }
  31. }
  32.  
  33. fclose(f);
  34. system("cls");
  35. main();
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement