Home > Back-end >  For simple string encryption
For simple string encryption

Time:09-20

function interface definition:
 void secret (char [] s1 and char [] s2); 

Parameters s1 is the original string, s2 is the encrypted string, the function request don't modify the original string s1,

The referee sample testing program:
This procedure to enter a literal string, the output of the original and the encrypted new chain,
 # include & lt; Stdio. H> 
# define N 1000

Void secret (char [] s1 and char [] s2);

Int main ()
{
[N] char a, b [N].
Gets (a);
Secret (a, b);
Puts (a);
Puts (b);
return 0;
}

/* * your code will be embedded in here/
Input the sample:
How are you!
The output sample:
How are you!
Krz# duh# | rx $

CodePudding user response:

Traversal string s1, each character + 1 (or other) assigned to s2
For example:
While (s1 [I]!='\ 0')
{
[I] s2=s1 [I] + 1;
i++;
}
S2 [I]='\ 0';
Like this

CodePudding user response:


Your code:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void secret (char [] s1 and char s2 []) {
While (* s1) {
* * s1 + s2=3;
S1 + +, s2 + +;
}
}

CodePudding user response:


Displacement, left, right,

CodePudding user response:

Get ciphertext expressly, each character + 3,
  • Related