Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include "stdio.h"
  2. #include "string.h"
  3.  
  4. typedef struct{
  5. char linhas[100];
  6. }LINHAS;
  7.  
  8. void main(){
  9. int i=0,n;
  10. char palavra[100];
  11. scanf("%s", palavra );
  12. LINHAS st[100];
  13. char fa[100];
  14. FILE * f = fopen("tatas.txt", "r");
  15.  
  16. while(fscanf(f, "%[^\n]\n", fa)!=EOF){
  17. strcpy(st[i].linhas, fa);
  18. i++;
  19. n=i;
  20. }
  21. for(int i =0; i<=100;i++){
  22. if(strstr(st[i].linhas,palavra)!=NULL){
  23. printf(st[i].linhas);
  24. }
  25.  
  26. }
  27. fclose(f);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement