-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10222(decode).cpp
More file actions
60 lines (59 loc) · 830 Bytes
/
10222(decode).cpp
File metadata and controls
60 lines (59 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include<stdio.h>
#include<string.h>
#include<ctype.h>
char check(char p);
char key1[13]="qwertyuiop[]";
char key2[12]="asdfghjkl;'";
char key3[11]="zxcvbnm,./";
int main()
{
char input[10000],c,result;
int i,k;
gets(input);
i=strlen(input);
for(k=0;k<i;k++)
{
c=input[k];
if(c==' ')
printf(" ");
else
{
if(isalpha(c))
{
if(islower(c))
{
result=check(c);
printf("%c",result);
}
else
{
c=tolower(c);
result=check(c);
printf("%c",result);
}
}
else
{
result=check(c);
printf("%c",result);
}
}
}
printf("\n");
return 0;
}
char check(char c)
{
int i;
char r;
for(i=0;i<13;i++)
{
if(c==key1[i])
r=key1[i-2];
else if(c==key2[i])
r=key2[i-2];
else if(c==key3[i])
r=key3[i-2];
}
return r;
}