SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main() {
  5.  
  6.   printf("CAMEL_CASE\n");
  7.  
  8.   char test[255];
  9.  
  10.   scanf("%[^\n]", &test);
  11.   getchar(); // ini gw tambahin getchar();
  12.  
  13.   int length=strlen(test);
  14.  
  15.   // int i=0; ini gua ganti jadi -1 biar pas gw ++ mulainya dari 0
  16.   int i = -1;
  17.   // char currentCharacter = test[i]; ini gua pindahin ke dalem while
  18.  
  19.   // while(i<length){ // ini gw ganti jadi i++
  20.   while(i++ < length) {
  21.     char currentCharacter = test[i];
  22.  
  23.     if (currentCharacter == '_'){
  24.       continue;
  25.     }
  26.    
  27.     if (i != 0 && test[i-1] == '_'){
  28.       printf("%c", currentCharacter);
  29.       continue;
  30.     }
  31.    
  32.     if (currentCharacter >= 'A' && currentCharacter <= 'Z'){
  33.       currentCharacter += 32;
  34.     }
  35.    
  36.     printf("%c", currentCharacter);
  37.     // i++; ini gw gapake, gw ++ nya diatas, soalnya kalo ++ dibawah gabakal ketambah karena ke skip sama continue;
  38.   }
  39.  
  40.   return 0;
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top