Advertisement
sellmmaahh

string-ROT13

Aug 8th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4.  
  5. void ROT13 (char *s) {
  6.     while (*s!='\0') {
  7.             if ((*s>='a' && *s<='m') || (*s>='A' && *s<='M')) *s+=13;
  8.             else if ((*s>='N' && *s<='Z') || (*s>='n' && *s<='z')) *s-=13;
  9.              s++;
  10.     }}
  11.  
  12. int main () {
  13.     printf("Unesite recenicu: ");
  14.     int i=0;
  15.     char recenica[100], c;
  16.     do {
  17.             c=getchar();
  18.     recenica[i]=c;
  19.     i++;
  20.     }
  21.     while (c!='\n' && i<100);
  22.     recenica[i-1]='\0';
  23.  
  24.     ROT13(recenica);
  25.     printf("Nova recenica: %s",recenica);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement