Home > Back-end >  For help
For help

Time:05-13

How c + + console input string with the string file comparison, and string how changes in the file, save the children's

CodePudding user response:

Fyi:
 # include & lt; Conio. H> 
#include
Char pw [40].
Int I, ch.
The FILE * f;
Void main () {
Cprintf (" \ r \ nPassword: ");
i=0; Pw [I]=0;
While (1) {
Ch=getch ();
If (ch==13 | | i>=39) break;
The switch (ch) {
Case of 27:
Cprintf (" 40 \ rPassword: % s ", "");
Cprintf (" \ rPassword: ");
i=0; Pw [I]=0;
break;
Case 8:
If (i> 0 {
i--;
Pw [I]=0;
Cprintf (" b \ \ b ");
}
break;
Default:
Pw [I]=ch;
i++;
Pw [I]=0;
Cprintf (" * ");
break;
}
}
Cprintf (" \ r \ n ");
F=fopen (" password. TXT ", "w");
Fprintf (f "% s \ n", pw);
fclose(f);
}

CodePudding user response:

String can compare equal hash value, hope to adopt, can focus on direct messages I don't understand,
  • Related