CodePudding user response:
In fact this is the problem that a user experienceTo change the program control logic
Add one line of output, prompt the user, what is it you just input, if confirmed, will continue to other, otherwise it returns to enter
Problem is to do so when you input is right, but also one by one test, will feel very troublesome
A balanced approach, input data, you want to keep in the file is in the center, let the program to read from the file
To the inside of the file content is change, changed again you can save after confirmation, and then to run the program, to avoid this problem
CodePudding user response:
There is also a skill complement, after all read to write files to open and read from the file operations, such as to change the codeThe following skills, don't have to change a code, that is using the Windows command line pipe capacity
Windows command line, you can use alternative keyboard input file
CMD, such as your exe is 1. Exe
So 1. Exe & lt; A.t xt
Can make a.t of xt content as the content of the keyboard input to 1. Exe files to
This program code without change, by editing the 1. TXT to fix you repeated use of the input