Wi-front password protection calculator

xiaoxiao2021-03-05  37

#include #include

/ * This program is a calculator for the width of the password. The first line is two steps. The second line is four-step results * / / * The program is mostly the indigenous people (Yujiezuo), I only responsible for small Some procedures and modified debugging work * /

/ * The essence part of the program is in the second subroutine, which is Void Cryptogram (int *). This is YUJIEZUO. At that time, we used his algorithm to write a program, and I failed :-( * / / * There is a goto statement in the program. It is a taboo of C #. If you read the program, it is easy to remove it in the main function, so that the program can only calculate once at once * /

/ * The most important thing for this program is the robustness of the program. We have spent a lot of hard blood. No matter what illegal characters you entered, there will be corresponding statements, but also support back. * / / * Progammed by Yujiezuo & gw ---- GW * /

Void teller (int G []) / * Take 20 courses, automatically pop up after entering 20 bits, no need to knock back * / {INT I, C, LENTH, Y; CHAR PR [30] = "/ NPLEASE INPUT THE NUMBER : "; LENTH = STRLEN (PR); for (i = 0; I <20; i ) g [i] = 0; Printf (PR); for (i = 0; i <20; i ) {c = getChe (); If (c == 8) {i- = 2; Printf ("/ b"); if (i <-1) {printf (":"); i ;} Continue;} g [i] = (C-48); IF (g [i]> 10 || g [i] <0) {printf ("/ a"); if (g [i] == - 35) / * Resist against Enter * / {Y = wherey (); gotoxy (LENTH I, Y);} else printf ("/ b / b"); / * The rest of the illegal character * / i--; continue;}}}

Void Cryptogram (int G []) / * obtains a password, the password will be overwritten, the extracter's essence * / {INT I, C, K = 0, H [20]; / * K is a counter, spent a long Time debugging * / for (i = 0; i <20; i ) {g [i] = 0; h [i] = 0;} printf ("/ NPLEase Input your cryptogram:"); for (i = 0; i <20; i ) {c = getChe (); k ; if (c == 8) / * to process the retracted marker * / {i- = 2; Printf ("/ b"); if (i <-1) / * If there is no need to knock the number, it will have an error, which is the handling of this situation * / {Printf (":"); k ; i ;} k- = 2; Continue } If (c == 13) {k = k-1; Break;} / * Enter, input * / if (c> 58 || c <48) / * to non-digital processing * / {k -; i-; printf ("/ b / b"); Continue;} g [i] = C-48; Printf ("/ b *"); / * This is * overwriting password * /} for (i = (20-k); i <20; i ) h [i] = g [i k-20]; for (i = 0; i <20; i ) g [i] = h [i] ; / * The robustness of the program is very good * /} void twoadd (int G [], int h []) / * (because the 20 digits are too long, only in the array), two A 20-digit group is added, the result is released In the first array * / {int y [21], i; / * y [] is carry memory * / y [20] = 0; for (i = 19; I> = 0; I -) { g [i] = g [i] h [i] y [i 1]; y [i] = g [i] / 10; g [i]% = 10;}}

Void TenAdd (int G [], int h []) / * two 10-bit arrays add * / {INT Z [11], i; / * z [] is carrying a memory * / z [10] = 0; For (i = 9; i> = 0; I -) {g [i] = g [i] h [i] z [i 1]; z [i] = g [i] / 10; g [i]% = 10;}}

Void newone (int G [], int h []) / * Generate new 20-digit group * / {INT i; for (i = 0; i <20; i ) {if (! g [i]) g [ I] = 10; g [i] = h [g [i] -1];}} void main () {INT I, L, A, B; Int M [20], N [20], X [10 ], y [10]; Next: for (i = 0; i <20; i ) {m [i] = 0; N [i] = 0;} for (i = 0; i <10; i ) { X [i] = 0; y [i] = 0;} teller (m); Printf ("/ n / n"); Cryptogram (N); TwoAdd (M, N); for (i = 0; i < 10; i ) {x [i] = m [i]; y [i] = m [i 10];} TenAdd (x, y); printf ("/ n / n / n"); for (i = 0; I <10; i ) Printf ("% d", x [i]); printf ("/ n / n / n"); newone (m, x); for (i = 0; i <10 ; i ) {x [i] = m [i]; y [i] = m [i 10];} TenAdd (x, y); Printf ("/ n / n"); for (i = 0; I <10; i ) Printf ("% d", x [i]); Printf ("/ n / n / n"); Printf ("Press any two same keys to exit / nor press esc to exit / npress Enter To Continue / N "); A = getChe (); if (a == 27) exit (); if (a == 13) goto next; b = getChe (); if (ab) goto next;}

转载请注明原文地址:https://www.9cbs.com/read-33342.html

New Post(0)