Advertisement
rrcfs

Manipulação de strings

Oct 2nd, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. #include<conio.h>
  2. #include<stdlib.h>
  3. #include<stdio.h>
  4. #include<string.h>
  5. #define TF 100
  6.  
  7. void LeTexto (char texto[TF])
  8. {
  9.     printf("Digite o texto");
  10.     gets(texto);
  11. }
  12. void Exibe(char texto[TF])
  13. {
  14.     printf("\nDigite o texto:%s\n", texto);
  15.     getch();
  16. }
  17. void ConcatenaChr(char texto[TF], char letra)
  18. {
  19.     texto[strlen(texto)+1]='\0';
  20.     texto[strlen(texto)]=letra;
  21. }
  22. void ConcatenaSte(char Frase[TF], char Aux[TF])
  23. {
  24.     ConcatenaChr(Frase, ' ');// ou strcat(Frase+" "); obs: entre aspas;
  25.     strcat(Frase, Aux);
  26. }
  27. void Modifica(char texto[TF], char Aux[TF])
  28. {
  29.    
  30.     int pos;
  31.     printf("\nDigite a Posicao:\n");
  32.     scanf("%d", &pos);
  33. }
  34. char LeChr(void)
  35. {  
  36.     printf("\nCaractere:");
  37.     return getch();
  38. }
  39.  
  40. int main(void)
  41. {
  42.    
  43.     char F[TF], caracter, Aux[TF];
  44.     LeTexto(F);
  45.     ConcatenaChr(F, LeChr());
  46.     Exibe(F);
  47.     LeTexto(Aux);
  48.     ConcatenaChr(F, LeChr());
  49.     Exibe(F);
  50.    
  51.     Modifica(F, Aux);
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement