Today, the author in the University of ACM Network competition, encountered in the input format has such a requirement: the input contains multiple lines of data, please handle to the end of the file. The logic of the topic is very simple, the main function code is easy to implement, but there is no "explicit" in the title of the console to indicate how the input data to end, such as: #, double carriage return, and so on. The author tries to use the CLOCK_T variable control program running time, but the evaluation platform displays "Compile error". After careful analysis, the author gets the answer, "input contains multiple lines of data, please handle to the end of the file" means that when enough data is entered, you can use "Ctrl + Z" to exit the console, that is, "Processing file End", because: Ctrl + Z will make the scanf () function return-1, So when dealing with this type of problem you can take advantage of "while (scanf ("%d%d ", &a,&b)!=eof) {function ()}" To achieve.
C language about the "input contains multiple lines of data, please handle to file end" issue