Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void unesi(char niz[], int velicina)
- {
- char znak = getchar();
- if (znak == '\n')
- znak = getchar();
- int i = 0;
- while (i < velicina - 1 && znak != '\n')
- {
- niz[i] = znak;
- i++;
- znak = getchar();
- }
- niz[i] = '\0';
- }
- char* rot13 (char *string)
- {
- char* s = string;
- char* ret = string;
- while (*s != '\0')
- {
- if(*s >= 'A' && *s <= 'Z') {
- if(*s >= 'N') {
- *s = *s - 13;
- s++;
- continue;
- }
- *s = *s + 13;
- }
- if(*s >= 'a' && *s <= 'z')
- {
- if(*s >= 'n') {
- *s = *s - 13;
- s++;
- continue;
- }
- *s = *s + 13;
- }
- s++;
- }
- return ret;
- }
- int main() {
- char niz[100];
- unesi(niz, 100);
- printf("%s", rot13(niz));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement