Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. char *rumdreh(char *str){
  6. int i, r,l,j;
  7. char safe;
  8. r = strlen(str)-1;
  9. l = 0;
  10. while(l<r){
  11. safe = str[l];
  12. str[l] = str[r];
  13. str[r] = safe;
  14. l +=1;
  15. r -=1;
  16. }
  17. return str;
  18. }
  19.  
  20.  
  21. int main () {
  22. char str[50];
  23. char ersatz[64];
  24. int len;
  25. int i, r,l,j;
  26. int count = 0;
  27. char safe;
  28. char vocals[] = "aeiou";
  29. char copy[64];
  30.  
  31. strcpy(str, "A23lloc 23 a1 te2d");
  32.  
  33. for(i=0;i<strlen(str);i++){
  34. if(!isdigit(str[i])){
  35. ersatz[count] = str[i];
  36. count +=1;
  37. }
  38. }
  39. printf("%d\n", strlen(ersatz));
  40. printf("%s\n", ersatz);
  41. r = strlen(ersatz)-1;
  42. l = 0;
  43. while(l<r){
  44. safe = ersatz[l];
  45. ersatz[l] = ersatz[r];
  46. ersatz[r] = safe;
  47. l +=1;
  48. r -=1;
  49. }
  50. int idx = 0;
  51. char newest[64];
  52. for(i=0;i<strlen(ersatz);i++){
  53. if(!(ersatz[i] == ' ')){
  54.  
  55. newest[idx] = ersatz[i];
  56. idx +=1;
  57. }
  58. }
  59. newest[idx] = '\0';
  60.  
  61.  
  62. for(i=0;i<strlen(newest);i++){
  63. for(j=0;j<strlen(vocals);j++){
  64. if(newest[i] == vocals[j]){
  65. newest[i] = toupper(vocals[j]);
  66. break;
  67. }
  68. }
  69.  
  70. }
  71.  
  72. strcpy(ersatz, newest);
  73. strcpy(copy, ersatz);
  74.  
  75. strcat(ersatz, rumdreh(copy));
  76. printf("%s\n", ersatz);
  77.  
  78.  
  79.  
  80. return(0);
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement