Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define MAX 10000
- /* 36. Dado um texto de entrada, verifique quantas vezes aparecem ocorrências da palavra ‘web’. */
- int main()
- {
- char texto[MAX];
- int i,existe=0;
- printf("\n Digite o texto: \n");
- fgets(texto,MAX,stdin);
- for(i=0;i<strlen(texto);i++)
- {
- if((texto[i]==87 || texto[i]==119)&&(texto[i+1]==69 || texto[i+1]==101)&&(texto[i+2]==66 || texto[i+2]==98))
- {
- existe++;
- }
- }
- printf("\n A palavra 'web' existe %d vezes!!",existe);
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement