Advertisement
Cinska_polivka

Hello World #2

May 29th, 2011
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. //helloworld.c
  2. //Cinska polivka's first n00bish výtvor
  3.  
  4. #include <string.h>
  5. #include <stdio.h>
  6.  
  7. int main(int argc, char **argv)
  8. {
  9.    
  10.     char *arg = argv[1];
  11.     //char b[] = "ahoj";
  12.     char *p = arg;
  13.    
  14.     int i=0;
  15.     int text;
  16.    
  17.     for(i=0; i < strlen(p); i++)
  18.     {
  19.         text = arg[i];
  20.         if(text >= 'a' && text <= 'z')
  21.         {
  22.             text -= 84;
  23.             text = text % 26 + 97;
  24.         }
  25.         else if(text >= 'A' && text <= 'Z')
  26.         {
  27.             text -= 52;
  28.             text = text % 26 + 65;
  29.         }
  30.         printf("%c", (char)text);
  31.     }
  32.     printf("\n\n");
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement