Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. void strrev(char *s);
  5. void ucase(char *s);
  6.  
  7. int main()
  8. {
  9.     char s[]="NAGY betut nem forditjA MEG";
  10.     strrev(s);
  11.     printf("Megfordit: %s\n", s);
  12.     ucase(s);
  13.     printf("Nagybetus: %s\n", s);
  14.     return 0;
  15. }
  16.  
  17. void strrev(char*s)
  18. {
  19.     int i,len;
  20.     char temp;
  21.     for(len=0;s[len];len++);
  22.     for(i=0;i<len/2;i++)
  23.     {
  24.         if(!(s[i]>='A'&&s[i]<='Z')&&!(s[len-i-1]>='A'&&s[len-i-1]<='Z'))
  25.         {
  26.             temp=s[i];
  27.             s[i]=s[len-i-1];
  28.             s[len-i-1]=temp;
  29.         }
  30.     }
  31. }
  32.  
  33. void ucase(char*s)
  34. {
  35.     int i;
  36.     for(i=0;s[i];i++)
  37.     {
  38.         if(s[i]>='a'&&s[i]<='z')
  39.         {
  40.             s[i]+='A'-'a';
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement