Recently in the fourth edition of the Learning algorithm, in order to use the test data given by the author Alg4-data, you need to import the data directly into the program. This is done using redirects in the author's sample code, but it's inconvenient to use redirects in Eclipse, and there's a lot of information that's added to the arguments in the run configurations in the right-click Run as. The arguments parameter. Tried many times invalid, give up. Then found in the common option there is a standard input and output, the input file selected path Click Run on the line. But after run, you can press CTRL + Z in the console to finish.
My version of Eclipse is
Version:mars.1 Release (4.5.1)
Build id:20150924-1200
If it's still not working,
Method One: Directly with the Scanner class.
Direct Read input: Scannerstdin = new Scanner (system.in); Use Crtl+z to terminate input
Read in from text: Scannerstdin = new Scanner ("file name");
while (Stdin.hasnext ()) {
int key =stdin.nextint ();
}
Method Two: After the Eclispse is compiled, execute it in the command line.
Reference: http://www.cnblogs.com/zhcncn/p/4689225.html
http://leetschau.github.io/blog/2013/01/23/125458/
Eclipse redirect Input output to file