FranciscoSoccol

Lista 04 - Exercicio 34

Jul 7th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. //Dado um texto de entrada, verifique se existe a palavra ‘web’.
  2. #include<stdio.h>
  3. #define max 500
  4. int main()
  5. {
  6.     char texto[max];
  7.     int i,cont=0;
  8.     printf("Digite o texto: ");
  9.     gets(texto);
  10.     for(i=0;texto[i]!='\0';i++)//verificando os caracteres
  11.         if(texto[i]=='w' && texto[i+1]=='e' && texto[i+2]=='b')
  12.             cont++;
  13.     if(cont!=0)
  14.         printf("Existe a palavra web no texto.");
  15.             else
  16.                 printf("Nao existe a palavra web no texto.");
  17.     getch();
  18. }
Advertisement
Add Comment
Please, Sign In to add comment