Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. /*Esercizio N6 - Novizio
  2.  
  3. Inserita una frase, voglio che tutte le vocali vengano sostituite con la lettera X e poi che la nuova frase venga
  4. stampata su schermo.
  5.  
  6. Piccolo consiglio: qui si parla di stringhe.*/
  7.  
  8. #define STRINGALEN 50
  9.  
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13.  
  14. int vocali_Mod (int c);
  15.  
  16. int main ()
  17. {
  18. char s[80];
  19. int i;
  20. gets(s);
  21. for (i=0; i<STRINGALEN; i++)
  22. {
  23. if (isalpha(s[80]) && vocali_Mod(s[80]))
  24. {
  25. s[80] = 'X';
  26. }
  27. }
  28. puts(s);
  29. }
  30.  
  31. int vocali_Mod (int c)
  32. {
  33. switch(c)
  34. {
  35. case 'A' : ;
  36. case 'a' : ;
  37. case 'E' : ;
  38. case 'e' : ;
  39. case 'I' : ;
  40. case 'i' : ;
  41. case 'O' : ;
  42. case 'o' : ;
  43. case 'U' : ;
  44. case 'u' : return 1;
  45. default : return 0;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement