Academic leave-deciphering passwords and academic leave deciphering
Egg receives two encrypted passwords. The cracking rule is: extract the numbers of the two passwords and then add the upper and lower numbers. If not, 0 is used instead, add the last number to 70 to get the ASCII Value of the letter, and finally find the password.
For example:
Sample input:
@ # GHt1GG6gB70h) * 4 ^ 2! * 6
% G5 = j6 % Gg3 $ g6h0 @
1 6 7 0 4 2 6
5 6 3 6 0
==================
6 12 10 6 4 2 6
Sample output:
LRPLJHL
/** Copyright (c) 2015, Emy of computer science, Yantai University * All gight reserved. * file name: temp. cpp * Author: Shao Shuai * completion time: July 15, January 18, 2015 * version: v1.0 */# include <iostream> # include <cstdio> using namespace std; int main () {int num1 [81], num2 [81], num3 [81]; // defines three numeric arrays: char str1 [81], str2 [81]; // define two string Arrays: int j1, j2, j3, I = 0, swa; // swa is used to forcibly convert the character array to the ASCII value j1 = j2 = 0; // initialize j1, j2 gets (str1); gets (str2); // input string! # Include <cstdio> header file while (str1 [I]! = '\ 0') // The last character of the string is' \ 0', which is used to determine whether the character array has reached the last position {swa = (int) str1 [I]; // forcibly convert if (swa> = 48 & swa <= 57) {num1 [j1] = (swa-48); // Save the filtered number in the number array, -48 for the numeric ASCII code value. // cout <num1 [j1] <""; Use j1 ++ for testing data;} I ++ ;} // cout <endl; I = 0; // initialize I while (str2 [I]! = '\ 0') // same as {swa = (int) str2 [I]; if (swa> = 48 & swa <= 57) {num2 [j2] = swa-48; // cout <num2 [j2] <""; j2 ++;} I ++;} // cout <endl; if (j1> j2) // used to determine who is big and who is small in the two numeric arrays, the small one will be supplemented with 0 {for (j2 + 1; j2 <j1; j2 ++) num2 [j2] = 0;} if (j2> j1) {for (j1 + 1; j1 <j2; j1 ++) num1 [j1] = 0 ;} // cout <"==========================" <endl; for (j3 = 0; j3 <j1; j3 ++) // Add the numbers of the two arrays, obtain the final array num3 [] {num3 [j3] = num1 [j3] + num2 [j3] + 70; cout <(char) num3 [j3]; // forcibly converted to characters }}
Running result:
@ Mayuko