elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación C/C++ / contador de palabras, con funcion que devuelve valor erroneo en: 3 Marzo 2017, 01:58 am
Código
  1. include <stdio.h>
  2. #include <conio.h>
  3. #include <math.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6.  
  7. int conv()
  8. {
  9. char frase[200];
  10. int cont,x,y,lon,cont2;
  11.  
  12.  
  13.    printf("ingresa una frase\n");
  14.    fflush(stdin);
  15.    gets(frase);
  16.    lon=strlen(frase);
  17.    for(x=0;x<=lon;x++)
  18.    {
  19.    if(frase[x]=='a')
  20. {
  21.  
  22. cont=cont+1;
  23. return cont;
  24.  
  25.  
  26. }
  27.    }
  28.  
  29.    }
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. main()
  38. {
  39. int z;
  40. z=conv();
  41. printf("%d",z);
  42.  
  43.  
  44.  
  45. return 0;
  46. }
  47.  


· Los códigos deben ir en etiquetas GeSHi
>aquí las reglas del foro
-Engel Lex
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines