Advertisement
Guest User

Untitled

a guest
Dec 11th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. char castToBig(char ch){
  4.     return ch+32;
  5. }
  6.  
  7. char castToSmall(char ch){
  8.     return ch-32;
  9. }
  10.  
  11. int isBig(char ch){
  12.     return ch >= 'A' && ch <= 'Z';
  13. }
  14.  
  15. int isSmall(char ch){
  16.     return ch >= 'a' && ch <= 'z';
  17. }
  18.  
  19. int main()
  20. {
  21.     char cur;
  22.     int make_big = 0;
  23.     printf("yahani");
  24.  
  25.     while(cur != '\n'){
  26.         printf("yahani");
  27.         scanf("%c", &cur);
  28.  
  29.         if(cur == '_'){
  30.             make_big = 1;
  31.             continue;
  32.         }
  33.  
  34.         if(make_big){
  35.             make_big = 0;
  36.  
  37.             if(isSmall(cur))
  38.                 cur = castToBig(cur);
  39.         } else {
  40.             if(isBig(cur))
  41.                 cur = castToSmall(cur);
  42.         }
  43.  
  44.         printf("%c", cur);
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement