Discussion of challenges you have already solved
-
manaregen
- Posts: 2
- Joined: Sat Jun 13, 2015 2:12 pm
- Location: S. Korea
-
Contact:
Post
by manaregen »
ABCDEFGHIJKLMNOPQRSTUVWXYZ
RSTUVWXYZABCDEFGHIJKLMNOPQ
C solution:
Code: Select all
#include <stdio.h>
#include <string.h>
int main() {
char input[200] = "cqrb lryqna rb fjh, fjh qjamna cqjw axc cqracnnw. qnan, hxd wnena twxf qxf oja cx bqroc! xq kh cqn fjh, cqn jwbfna rb mnjmvjwblqnbc.";
int i, len;
len = strlen(input);
for (i=0; i<len; i++) {
if (input[i] == 0x20 || input[i] == 0x21 || input[i] == 0x2c || input[i] == 0x2e) continue;
else if (input[i] <= 'i') input[i] += 17;
else input[i] -= 9;
}
printf("%s\n", input);
return 0;
}
-
draw_in_dust
- Posts: 1
- Joined: Thu Mar 24, 2016 12:35 am
Post
by draw_in_dust »
Another in C:
#include <stdio.h>
#include <string.h>
Code: Select all
int main(void){
char x[132] = "cqrb lryqna rb fjh, fjh qjamna cqjw axc cqracnnw. qnan, hxd wnena twxf qxf oja cx bqroc! xq kh cqn fjh, cqn jwbfna rb mnjmvjwblqnbc";
for (int i=0, n=strlen(x); i<n; i++){
if (x[i]!=' ' && x[i]!= ',' && x[i]!='.' && x[i]!='!'){
x[i] = (((x[i] - 97) + 17) % 26) + 97;
}
printf("%c", x[i]);
}
printf("\n");
}